Tag Info

Hot answers tagged

2

The type of redirect you are using is not the problem. 301 redirects are cacheable. In fact they are extremely hard to cache bust. 301 means "permanent" and browsers are very likely to cache 301 redirects with no way with the server to undo one that is already cached. 302 redirects are generally not cached by default unless other headers indicate that ...


2

The problem is that, when you use mod_rewrite in an .htaccess file or a <Directory> section, every successful RewriteRule — even an internal one — causes the request to be restarted internally, and thus the whole rewrite ruleset to be reprocessed. Thus, what's happening is that, when the user visits /page, your internal RewriteRule matches ...


2

I asked this same question on StackOverflow. To get it to work properly, you have to use environment variables: RewriteRule ^page$ /page.html [L,E=LOOP:1] RewriteCond %{ENV:REDIRECT_LOOP} !1 RewriteRule ^page.html$ /page [R=301,L] This is because mod_rewrite does multiple passes through your rules. During the first pass, it sets the environment ...


1

You can do this with a single RewriteRule. The trick here is to only check for valid username characters, not everything (ie. .* - I wouldn't have thought your usernames could literally be anything?). This would also be more efficient since not every request will match and be processed. For example, assuming your usernames can only consist of ...


1

Problem fixed through one heck of a lot of perseverance. I really should take the time to learn all of mod_rewrite at some point in timeā€¦ In short I solved the redirect loop with the following condition: RewriteCond %{REQUEST_URI} !^/remote.php/ The above condition basically matches everything that isn't remote.php/ANYTHING_HERE I then used the above ...


1

What is the purpose of the redirect? The 301 Canonical The purpose of your redirect is to assure a canonical domain name. As such, the appropriate HTTP response is a 301. By default, many browsers will cache this indefinitely unless you specify a Cache-Control header. The 302 Confusion In the Google reference you provide, they are talking about landing ...



Only top voted, non community-wiki answers of a minimum length are eligible