I want to
redirect http://www.mysite.com/index.php?option=com_content&view=frontpage&Itemid=1
TO
http://www.mysite.com/
Can you please show me the 301 redirect rule for htaccess?
Thanks.
I tried the following, but no luck.
RewriteCond %{QUERY_STRING} ^option=com_content&view=frontpage&Itemid=1$
RewriteRule ^/index.php$ http://www.mysite.com [L,R=301]
You can try below configuration,
RewriteCond %{QUERY_STRING} option=com_content&view=frontpage&Itemid=1
RewriteRule index\.php$ /? [L,R=301]
I tried it on my domain and it works fine. Hope this works for you too... :)
According to www.htaccessredirect.net, the code to do this would be:
Redirect 301 /index.php?option=com_content&view=frontpage&Itemid=1 /
Alternatively, you could look in to using apache's mod_rewrite module.
Related
I am trying to do a simple redirection, but I encounter this error, when I do the 301 redirect using the htaccess, it returns the redirect but with the value
.htaccess
RewriteRule ^clientes/(\w+)/?$ clientes.php?id=$1 [L]
Redirect 301 /clientes/juan http://google.es
result:
https://www.google.es/?id=juan&gws_rd=ssl
It's because you are mixing mod-alias (Redirect) with mod-rewrite (RewriteRule) . These are two diffrent modules with diffrent runtime behaviour .
Try using this :
RewriteRule ^clientes/juan http://google.com [L,R=301]
RewriteRule ^clientes/(\w+)/?$ clientes.php?id=$1 [L]
Clear your browser cache before testing these rules.
this working, but my problem is with this line.
Rewriterule ^videos/(.*)_(.*).html$ index.php?tag=$1&page=$2 [L,NC]
Rewriterule ^videos/(.*).html$ index.php?tag=$1 [L,NC]
RewriteRule ^/videos/juan.html https://www.dominio .com/cat/conduccion-juan/ [R=301,L]
and this not working
redirect 301 /videos/juan.html https://www.dominio.com/videos/conduccion-juan.html
thank you!
I want to redirect all requests to http://www.example.com/category/* to http://www.example.com.
This is what I tried:
RewriteRule http://www.example.com/category/.* http://www.example.com [R=301,L]
Unfortunately, this does not work. Any ideas how to write the rule correctly?
Thanks!
You can use:
RewriteEngine on
RewriteRule ^category/ /? [NC,R=301,L]
Please try below thing.
RewriteEngine on
RewriteRule "http://www.example.com/category/.*" "http://www.example.com" [PT]
I am updating the Iirf.ini file to redirect sub.columbia.edu to giving.columbia.edu/video.
sub.columbia.edu is already redirecting to giving.columbia.edu.
How can I go one step further to redirect it to giving.columbia.edu/video.
Important Note: I would like the URL to show as sub.columbia.edu in the browser and not as giving.columbia.edu/video
#Redirect subdomain to specific URL
RewriteCond %{HTTP_HOST} ^sub\.columbia\.edu
RewriteRule ^/$ /video
The above doesn't work. Any ideas how I should modify this?
Thank you!
You can try this and see how it works for you.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^sub\.columbia\.edu
RewriteRule ^(.*) http://giving.columbia.edu/video [L,R=301]
Or you can do a redirect, this should work also.
Redirect 301 / http://giving.columbia.edu/video
I have link like this:
www.site.com/page.php?p=1
Need to rewrite it to friendly URLs in htaccess
RewriteRule ^home$ page.php?p=1
It works but now I have two active links with the same content.
Tried to add 301 redirect from old link to new but stuck in loop. Any ideas how to fix that?
Try matching against the actual request so that your rules won't loop:
RewriteCond %{THE_REQUEST} ^(GET|HEAD)\ /page\.php\?p=1(&|\ |^)([^\ ]*)
RewriteRule ^page\.php$ /home?%3 [L,R=301]
# then your internal rewrite
RewriteRule ^home$ page.php?p=1
Remove the redirect on the page and handle it in the htaccess.
RewriteRule ^page\.php\?p=1$ /home [L,R=301]
This will redirect to /home and stop the redirect loop you have now.
another quick & dirty way to prevent looping in these situations i've found is to add a querystring and then check for its existence in the redirect.
RewriteCond %{QUERY_STRING} ^p=1
RewriteCond %{QUERY_STRING} !foo=bar
RewriteRule ^page\.php$ /home [NC,R=301,L]
RewriteRule ^home$ page.php?p=1&foo=bar [NC,L]
found on this site: http://answers.oreilly.com/topic/542-how-to-properly-redirect-for-maximum-seo/
Redirect 301 /page.php?p=1 www.yourwebsite.com/home?p=1 RewriteRule
^home?p=1$ /page.php?p=1
I have read about htaccess redirect and rewrite on stackoverflow and on other sites and learned how to redirect simple pages and directories, but there are about 30 links remaining that I haven't been able to redirect. The reason appears to be because they contain "?" in the link's URL. I've tried the solutions posted but I haven't been able to make enough sense of them to succeed.
These work:
Redirect /Corpfleet.php htp://www.marketyourcar.cm/wraps.php
Redirect /drivers.php htp://www.marketyourcar.cm/drivers.php
Redirect /galleries.php htp://www.marketyourcar.cm/galleries.php
These do NOT work:
Redirect /ad.php?View=FAQ htp://www.marketyourcar.cm/advertiser-faqs.php
Redirect /ad.php?View=gallery htp://www.marketyourcar.cm/galleries.php
Redirect /ad.php?View=Materials htp://www.marketyourcar.cm/products-services.php
Yes, I know that the URL above is htp and .cm - I had to break it in order to make this post with my low reputation level.
If anyone can help with this I'd appreciate it.
Thanks
If you want to redirect from like:
site.com/index.php?blabla=1&id=32
to
site.com/contact.html
then use:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} blabla=1&id=32
RewriteRule ^(.*)$ http://www.site.com/contact.html? [R=301,L]
</IfModule>
Redirect can't handle that. RewriteRule can. This should work.
RewriteEngine on
RewriteRule ^/ad\.php\?View\=FAQ$ http://www.marketyourcar.cm/advertiser-faqs.php [R=301,L]
RewriteRule ^/ad\.php\?View\=gallery$ http://www.marketyourcar.cm/galleries.php [R=301,L]
RewriteRule ^/ad\.php\?View\=Materials$ http://www.marketyourcar.cm/products-services.php [R=301,L]
Or try this:
RewriteEngine on
RewriteRule ^/ad.php?View=FAQ$ http://www.marketyourcar.cm/advertiser-faqs.php [R=301,L]
RewriteRule ^/ad.php?View=gallery$ http://www.marketyourcar.cm/galleries.php [R=301,L]
RewriteRule ^/ad.php?View=Materials$ http://www.marketyourcar.cm/products-services.php [R=301,L]
This might work:
Example:
RewriteEngine On
RewriteRule ^/ad.php?View=FAQ$ http://www.marketyourcar.cm/advertiser-faqs.php? [R=301,L]
Add a trailing ? to the substitution URL to remove the incoming query.