Forum Moderators: phranque

Message Too Old, No Replies

RewriteRule redirects but doesn't update browser URL

         

delmanty

10:28 pm on Oct 9, 2009 (gmt 0)

10+ Year Member



Here's what we're doing:

- Redirecting directories of content from old server to a specific landing page on new server. (No filenames or directories are the same.)
- Force case insensitivity

The redirects work for almost all rules except for one (I haven't figured this out yet.)

But the odd thing is that I can't get the browser to show the new URL. It's got to be an Apache config that I'm missing, because it works great in another server environment.

Here's an example:

RewriteRule ^[Dd]irectory/[Ss]ub_[Dd]irectory(.*)$ http://example.com/dir/sub-dir [L]

When the incoming URL is:
http://example.com/Directory/Sub_Directory/main.asp

The page redirects to the correct location, but the browser URL is still shown as:
http://example.com/Directory/Sub_Directory/main.asp

g1smd

10:38 pm on Oct 9, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Use "LIVE HTTP Headers" to examine the HTTP transaction between your browser and the site.

Your code should produce a 302 redirect, unless something else interferes with it.

The 302 redirect would be bad in and of itself; you should have a 301 redirect here.

If you are not re-using the $1 back-reference, there is no need for '(' and ')' round the '.*' part. In fact the '.*' and the closing '$' are both completely redundant.

delmanty

12:06 am on Oct 10, 2009 (gmt 0)

10+ Year Member



Seems like I have to have the 301 redirect in. Thanks.