How to do an htaccess redirection for the following
http://goozga.com/demo/index.php?option=com_content&view=article&id=70
needs to rewrite the above URL to
http://goozga.com/demo/index.php?option=com_content&view=article&id=73
please help me?
Try something like:
RewriteCond %{QUERY_STRING} option=com_content&view=article&id=70$
RewriteRule .* index.php?option=com_content&view=article&id=73 [L]
Note that your question has nothing to do with Joomla but depends on Apache's mod_rewrite instead.
Within Joomla, you can also use the Redirect component. You would just have to add a new redirect rule with the first URL as the source and the second as the destination URL.
Related
I want to redirect from http://www.example.com/index.php?abz_xyz to http://www.example.com/abz_xyz with htaccess. I am using this code on my htaccess file Redirect /index.php?abz_xyz http://www.example.com/abz_xyz/ but this is not working kindly please help me
Something like this (my regex may be off)
The [L] means Last, so once the rewrite engine hits that line, it'll redirect immediately if it matches
RewriteEngine On
RewriteRule ^index\.php\?abz_xyz$ /abz_xyz/ [L]
Unfortunately I didn't get it solved by myself and need to ask for help. I want to redirect all urls which follow a certain pattern (in this case it contains "reviews/category"). These URLs supposed to be redirect to another url which is made up the first one:
http://[product-url]/reviews/category/[category-url]
supposed to be redirect to
http://[product-url].html
Furthermore it shouldn't matter if you call the url with or without www.
Example:
http://example.com/ford-blues/reviews/category/cars supposed to be redirect to http://example.com/ford-blues.html
Any help would be much appreciated.
Following code isn't working
RewriteEngine On
RewriteRule ^reviews/category/?$ $1\.html [R=301,L]
Try:
RedirectMatch 301 ^(.*)/reviews/category/ /$1.html
in the htaccess file in your document root.
Or using mod_rewrite:
RewriteEngine On
RewriteRule ^(.*)/reviews/category/ /$1.html [L,R=301]
I want to accomplish the following with htaccess redirect.
How do I replace/redirect this
/kb_results.asp?ID=16
by
/catalogsearch/result/?q=16
So the url in the end is domain.com/catalogsearch/result/?q=16
Thanks in advance for any tips or help.
Using mod_rewrite, you can add these rules to the htaccess file in your document root:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^ID=([0-9]+)$
RewriteRule ^kb_results.asp$ /catalogsearch/result/?q=%1 [L,R]
If you want the redirect to be permanent, change the R flag to R=301, or if you want the URI to be internally rewritten (instead of an external redirect), then remove the R flag entirely.
this is what I currently have:
http://www.example.com/main?page=2
http://www.example.com/query?page=5
http://www.example.com/archives?page=2
And I want to replace it with:
http://www.example.com/main/2
http://www.example.com/query/5
http://www.example.com/archives/2
But I still want to have $_GET['page'] :)
How to do it with htaccess?
In the htaccess file in your document root, add these rules (preferably above any routing rules that you may have):
RewriteEngine On
RewriteRule ^(.*)/([0-9]+)$ /$1?page=$2 [L]
I need a redirect from http://www.mysite.com/passport/365.html to http://www.mysite.com/passport/365.html?task=view
I try to do it like this
RewriteCond %{HTTP_HOST} ^/passport/365.html$
RewriteRule ^/?$ /passport/365.html?task=view [QSA]
and it doesn't work.
Please help.
try that :
RewriteEngine on
RewriteRule ^passport/365\.html$ http://www.mysite.com/passport/365.html?task=view [R]
I think in you example ur missing the **
so it should be something like :
RewriteRule ^/passport/365\.html$ /passport/365\.html?task=view [QSA]
I would recommend you use this plugin.
You can simply add the redirect rule to the plugin without modifying .htaccess
There is a component already build in Joomla called "redirect" where U can set-up your redirects, so you don't have to use .htaccess at all.
Here is a good tutorial: http://www.joomtraining.com.au/tutorials/joomla-1.6/creating-a-page-redirect
The problem with the .htaccess is that every redirect must be set in appropriate place in the file.