Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

3 Answers

RewriteEngine on
RewriteBase /soccer/
RewriteCond %{QUERY_STRING} (.*)name=(\w+)(.*)
RewriteRule teams.php %2?%1%3
share|improve this answer
add comment

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.

share|improve this answer
add comment

http://www.elated.com/articles/mod-rewrite-tutorial-for-absolute-beginners/

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.