Web Hosting Talk







View Full Version : mod_rewrite forcing a redirect?


krumms
02-09-2005, 11:01 AM
Hi all,

Having seen some posts on here regarding mod_rewrite, I decided to reacquaint myself with using it ... but I'm encountering a strange problem.

Obviously the advantage of mod_rewrite is that redirects are done internally: a request sent to http://www.blah.com/categories/gadgets is internally mapped to http://www.blah.com/index.php?action=categories&id=gadgets for example - no Location header is sent back to the client.

However, I'm getting HTTP redirects (301s) - and I'm not using the [R] flag. Any ideas why on earth this would be happening?

Here's my .htaccess (found in the documentroot):


Order allow,deny
Allow from all

AddDefaultCharset utf-8
Options +FollowSymLinks
DirectoryIndex index.php index.html

RewriteEngine On
RewriteRule ^a(.*)$ /customers/customer/projects/a$1
RewriteRule ^b(.*)$ /customers/customer/projects/b$1

krumms
02-09-2005, 11:33 AM
sort of fixed. A trailing slash after the project names seemed to do the trick:


RewriteRule ^a/(.*)$ customers/customer/projects/a/$1 [L]


Still not sure why I'd be getting 301s though :S

gogocode
02-09-2005, 07:14 PM
Originally posted by krumms
sort of fixed. A trailing slash after the project names seemed to do the trick:


RewriteRule ^a/(.*)$ customers/customer/projects/a/$1 [L]


Still not sure why I'd be getting 301s though :S

Absolute URLS redirect externally. /customers is absolute, customers is relative.