Hey Guys, I really need your help with writing seo url. I'm new to apache, mod rewrite and .htaccess and after a week without success.

I want to change:

sub.domain.com/soccer/teams.php?name=tigers to sub.domain.com/soccer/tigers

What should my link (tigers) be? how would i set this that it doesn't cause a .css|.jpg|.png errors. My .htaccess file is located in /soccer/ folder.

Please help or direct me to where i can fine help.

3 Answers 3

RewriteEngine on
RewriteBase /soccer/
RewriteCond %{QUERY_STRING} (.*)name=(\w+)(.*)
RewriteRule teams.php %2?%1%3

In principe you set the rewriting rule only to affect the PHP files.

The CSS, images, and so on, should be in a separate directory, e.g.: /media/css, /media/images, and the HTML output should contain a direct link to them, e.g.

<link type="stylesheet" href="/media/style.css">

You can check the HTML output and check whether the references are correct or not. You can also have a look at your errors.log file from your web server.



is a pretty decent starting place for those wanting to learn some mod-rewrite basics.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .