Reputation: 234
Hi I need to redirect using htaccess every request which points at: http://www.mydomain.com/index.php?option=com_content&view=category&layout=blog&id=293&Itemid=387 to this url: http://www.otherdomain.com
I've try to do it by:
redirect /index.php?option=com_content&view=category&layout=blog&id=293&Itemid=387 http://www.otherdomain.com
But it doesnt work. So I need Your help.
Upvotes: 0
Views: 72
Reputation: 785108
Better to use mod_rewrite for this stuff.
Enable mod_rewrite and .htaccess through httpd.conf
and then put this code in your .htaccess
under DOCUMENT_ROOT
directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^option=com_content&view=category&layout=blog&id=293&Itemid=387$
RewriteRule ^index\.php$ /? [L,R=302,NC]
Once you verify it is working fine, replace R=302
to R=301
. Avoid using R=301
(Permanent Redirect) while testing your mod_rewrite rules.
Upvotes: 2
Reputation: 2063
I think someone may need to extend my answer but you'll be looking to do something along the lines of:-
RewriteRule ^([^/]+)/? index.php?option=$1 [R=301,L]
The rule will require a regular expression so the server can compare the request.
Upvotes: 0