.htaccess Problem

Posted by ocergynohtna on Stack Overflow See other posts from Stack Overflow or by ocergynohtna
Published on 2008-11-11T23:43:31Z Indexed on 2010/05/09 21:38 UTC
Read the original article Hit count: 154

I'm having trouble with redirecting urls using the .htaccess file. This is how my htaccess file looks like:

Redirect 301 /file-name/example.php http://www.mysite.com/file-name/example-001.php
Redirect 301 /section-name/example.php http://www.my-site.com/section-name/example-002.php

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.mysite.com$ [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)/(.*)$ hqtemplates/articles.php?file_name=$2 [L]
php_value session.use_only_cookies 1
php_value session.use_trans_sid 0

Now the problem is that when I go to page: www.my-site.com/file-name/example.php instead of redirecting me to www.my-site.com/file-name/example-001.php it redirects me to www.my-site.com/file-name/example.php?file_name=example-001.php. For some reason it adds "?file_name=example-001.php" to the url. Anyone know's why this is happening and how to fix this?

© Stack Overflow or respective owner

Related posts about .htaccess

Related posts about http-status-code-301