Forum Moderators: phranque
redirect 301 /rd-rss/index.php\sectionid= [site.com...]
but then I found this tread: [webmasterworld.com...]
so now I'm trying with:
RewriteCond %{QUERY_STRING} ^sectionid=$
RewriteRule ^rd-rss/index\.php\?sectionid=$ /index.php?option=com_rd_rss_clone&id=2 [R=301,L]
but nothing happens.
Any help would be greatly appreciated.
Thanks
Ben
Options +FollowSymLinks
RewriteEngine on
Be sure to completely flush (delete) your browser cache before testing any new server-side code to avoid seeing stale results previously-cached by your browser.
Jim
Options +FollowSymLinks
RewriteEngine on
but it should work with just RewriteEngine on. It doesnt.
I am doing this on a joomla 1.5 site and before that, I tried all possible components and plugins with no success. This is why I wanted to try with .htaccess.
Is it maybe because of some of these?
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/¦\.php¦\.html¦\.htm¦\.feed¦\.pdf¦\.raw¦/[^.]*)$ [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
Put all of your external redirects (if any) first, followed by all of your internal rewrites. In each of those two groups, order your rules from most-specific to least-specific patterns and conditions. That is, rules which affect only one, or the fewest requests should go first, followed by those which affect more or most requests.
One exception is that HTTP_AUTH rule at the end. I don't know what it does, but if you have problems with authentication, then that rule should go first, its [L] flag should be removed, and all othe rules should very probably end with an [L] flag. I would say that all rules should always end with an [L] flag, but there are a few exceptions.
As usual, the joomla code is horribly inefficient; Put the last two rewriteconds first to improve your server response time.
Jim
# Copy HTTP:Authorization header value into HTTP_AUTHORIZATION variable for later use
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# Redirect /rd-rss requests if the "sectionid" variable is the only one in the query string and is blank
RewriteCond %{QUERY_STRING} ^sectionid=$
RewriteRule ^rd-rss/index\.php$ http://www.example.com/index.php?option=com_rd_rss_clone&id=2 [R=301,L]
#
# Rewrite specific URL requests to Joomla, but only if they do not resolve to existing files or directories
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^$¦(\.(php¦html?¦feed¦pdf¦raw))$¦/$¦^([^/]+/)*[^.]+$ index.php [NC,L]
In other words, you should see at least a doubling of speed of this rule because it will never do the file- and directory-exists twice in a row as it used to. And you'll actually see even more that a 50% improvement, because only those requests which match the rule pattern will invoke the processing of any of the RewriteConds, so neither the 'NOT index.php' test RewriteCond nor the disk read RewriteConds will be processed unless the rule pattern matches.
Other than that, this modified Joomla code should be entirely equivalent in function to the original.
Important: Should you decide to try it, you will need to replace all of the broken pipe "¦" characters with solid pipe characters before use; Posting on this forum modifies the pipe characters.
Jim
[edited by: jdMorgan at 11:04 pm (utc) on Jan. 7, 2010]