| 6:08 pm on Mar 21, 2011 (gmt 0)|
Yes, Redirect re-appends stuff automatically. However, in this case it looks like you're applying a redirect AFTER the request has already been internally rewritten. This redirect exposes the internal server path back out to the world as a URL.
Use RewriteRule syntax and the [R=301,L] flags.
End the substitution URL with a question mark to clear the query string data in the redirect.
Make sure the new code is positioned before any internal rewrites that will deal with the request.
| 6:52 pm on Mar 21, 2011 (gmt 0)|
Ok changed it to this:
RewriteRule ^(photos/)?washington-dc/rosslyn-virginia-skyline-dusk/$ http://example.com/photos/washington-dc/skylines-cityscapes/rosslyn-virginia-skyline-dusk/? [R=301,L]
Didn't work at the top of the list of rewrite rules, before this:
But it did work if I placed the rule after the above code and before the rewrite rules for showItem. I would prefer not to stick 200 unqiue rewrite rules in the middle of the main block of gallery rewrite code though because that block is generated automatically by the url rewrite module and if any changes are made to the module it wipes that block and rewrites it all. Can I add the:
At the top of the htaccess file? If it's in the htaccess file twice is that a problem? Thanks for the help!
| 6:57 pm on Mar 21, 2011 (gmt 0)|
The redirects need to be listed after the point where the module is enabled with the RewriteEngine On directive.
Putting that directive twice can cause problems and is best avoided.
The redirects must be listed before any internal rewrites are found.
The Regeneration code should not be touching the Options, RewriteEngine or RewriteBase directives. Change it not do so.
| 7:30 pm on Mar 21, 2011 (gmt 0)|
I moved the rule to directly after RewriteEngine On and before the internal rewrites start. I'm not sure what you mean "the redirects should not be touching..."? There is a line break after so they are not touching...please explain.
I tested this with an http server response code checker and there is a problem. It seems the first time you hit the old url in a browser you get redirected to the site's login page at:
The server response codes are all correct...show a 301 redirect from 1st url to 2nd, then a 200 OK. But the page shown visually is the login page. It seems that this happens with every browser the 1st time, but if you try again it redirects properly the 2nd time. Looks like session ID problems?
| 7:38 pm on Mar 21, 2011 (gmt 0)|
You said: "the redirects should not be touching..."?
I actually said: "The Regeneration code should not be touching the Options, RewriteEngine or RewriteBase directives."
That is, your script that wipes the .htaccess file clean and puts new code in it should not be touching the first three directives. It should not wipe those. It should only wipe and rebuild the actual rules.
Make sure you clear your browser cache before every test. You want to make requests to the server, not pull previous responses from the browser cache.
| 8:22 pm on Mar 21, 2011 (gmt 0)|
I see ok...something is still not right. After I clear the cache on both IE8 and Firefox I still get redirected to the login page with the url below the first time:
Then if I clear cache aain I get the correct redirect page. I am using Webmaster tools to clear cache on Firefox and InPrivate browsing+manually clearing the cache on IE8. Very strange...not sure I can trust this if it's going to redirect spiders to the login page.
| 1:38 pm on Mar 22, 2011 (gmt 0)|
g1smd...I'm still not able to resolve this. If I clear cache and even use private browsing session I am redirected to the login page each time. If I type it in again I am redirected to the correct page each time. It seems to be a conflict with Session IDs and the redirect. I think if this stays this way I'll have 200 pages indexed as "Welcome please login" etc. Any ideas on how this might be resolved? thanks again
| 8:37 pm on Mar 22, 2011 (gmt 0)|
I don't know enough about your site to take a guess.
Hope that jd sees this thread and has a better idea...
| 3:13 pm on Mar 23, 2011 (gmt 0)|
I hope so too...I tried stickymail but his box is full. Hopefully he'll see this because I haven't been able to get around the issue and the whole thing is stuck in limbo now