Forum Moderators: phranque
example.com/?format=feed&type=rss/
I'm still thinking the following should work
%{THE_REQUEST} \?format=feed RewriteCond %{THE_REQUEST} \?
RewriteCond %{QUERY_STRING} (^|&)format=feed($|&)
half the problems I have is I don't clear the browser cache
ExpiresActive On
ExpiresByType text/html "access"
ExpiresByType text/php "access"
Use of the [R] flag causes a HTTP redirect to be issued to the browser. If a fully-qualified URL is specified (that is, including http://servername/) then a redirect will be issued to that location. Otherwise, the current protocol, servername, and port number will be used to generate the URL sent with the redirect.
For what it's worth, the Apache documentation can weigh in.httpd.apache.org/docs/trunk/rewrite/avoid.html#redirect
It says your way is better. happy! mod_rewrite is actually supposed to be a last resort in favor of other directives designed to do a specific job (like redirect)
The most common situation in which mod_rewrite is the right tool is when the very best solution requires access to the server configuration files, and you don't have that access. Some configuration directives are only available in the server configuration file. So if you are in a hosting situation where you only have .htaccess files to work with, you may need to resort to mod_rewrite.
Optionally, you could simplify it just a touch by removing the domain name. Apache will use the current scheme and hostname.
If you can do it in one hop, that's ideal.
You can actually still write conditions with the <If> directive.
Fortunately the redirect directive can be placed in htaccess files, so the OP is still good.
The use of RewriteRule to perform this task may be appropriate if there are other RewriteRule directives in the same scope. This is because, when there are Redirect and RewriteRule directives in the same scope, the RewriteRule directives will run first, regardless of the order of appearance in the configuration file.
Unfortunately the new location of the actual data is in the format:
http://www.example.com/index.php?format=feed&type=rss
This format doesn't validate and I'm crazy about that stuff.
RewriteRule ^rss\.feed$ /index.php?format=feed&type=rss/ [L]
But this just gives me a 404. What am I missing?
I'm thinking I really should have just pointed the URL with the actual rss information to the old RSS URL.
The final directory slash? Or was that just a typo?
Other way around, you mean, right? The old URL should point to (= serve content from) the new location unless you've got a compelling reason to change the URL.
[edited by: bill at 2:56 am (utc) on Apr 29, 2013]
[edit reason] fixed [/edit]
Not on shared hosting.
I tried moving this rule higher in the htaccess
I just tried this form:
RewriteRule ^www.example.com/rss.feed$ www.example.com/index.php?format=feed&type=rss/ [L]
I'm wondering if there is some kind of conflicting rules in the core too.
[edited by: bill at 2:57 am (utc) on Apr 29, 2013]
[edit reason] fixed [/edit]