I have some subdomain URL's that I would like to 301 redirect to a new non-subdomain URL, could someone give me one example on how to do this so I can apply it to my other URL's.
The .com/url will vary quite a bit
Old URL:
http://products.mysite.com/klim--siteassign-Snowmobile--_n-96
New URL:
http://www.mysite.com/klim.html
Thanks
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 %{HTTP_HOST} ^products\.mysite\.com$ [NC]
RewriteRule ^([^-]+)-.*$ http://www.mysite.com/$1.html [L,R=301,NC]
Related
I have two domains in may server, a.com which is my main domain and a.fr which is my redirect domain.
I like when the user enter http://a.fr/dynamicpath/ automatically going to http://a.com/dynamicpath/, is it possible to accomplish this through htaccess?
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 %{HTTP_HOST} ^(www\.)?a\.fr$ [NC]
RewriteRule ^ http://a.com%{REQUEST_URI} [R=301,L]
I want this page:
http://mystore.com/Login.aspx?ReturnUrl=%2fPages%2fHome%2fUser%2fWish-list.aspx
to
http://mystore.com/en/ukeurope/home
So, I try to write a 301 redirection rule like this:
RewriteRule ^Login.aspx$ en/ukeurope/home? [R=301,L]
but when I want to try this redirection.
It gives me 404 not Found.
P.S. I don't want another one that is
mystore.com/Page/Login.aspx
to be redirected by this 301 redirection rule
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 %{THE_REQUEST} ^[A-Z]{3,}\s/+Login\.aspx?ReturnUrl=\%2fPages\%2fHome\%2fUser\%2fWish-list\.aspx [NC]
RewriteRule ^ /en/ukeurope/home? [R=302,L]
We have a specific section of games called com_games. Could someone advise on how to rewrite url by adding parameter of & through htaccess so as have 301 redirect
From
http://www.abc.com/?page=4&option=com_games&view=list&Itemid=2
to
http://www.abc.com/?page=4&&option=com_games&view=list&Itemid=2
This needs to be achieve in all pagination pages, How to append & in the url for 301 redirection
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 %{THE_REQUEST} ^[A-Z]{3,}\s/\?(page=[^&]+)&([^&][^\s]+)\s [NC]
RewriteRule ^ %{REQUEST_URI}?%1&&%2 [R=301,L]
I need to 301 redirect all ?print=yes URLs to the URLs without ?print=yes that contain the same name in them through .htaccess. Currently the button to PRINT is present in the header of the website so it's more than 70 URLs to fix... Removing the button to PRINT the page will ruin the design quite a bit, so it's not really an option.
I think it needs to be a RedirectMatch rule, but how do I write it?
Example: redirect 301 from domain.com/faq/?print=yes to domain.com/faq
Thanks in advance!
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} ^print=yes$ [NC]
RewriteRule ^ %{REQUEST_URI}? [R=301,L,NE]
I am not sure if redirect can do the same but here is how I would do it with rewrite
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\?print=yes$ $1 [NC]
I am looking to rewrite all calls to
subdomain.domain.com/video.mp4
to rewrite to
https://s3.amazonaws.com/whatever/video.mp4
How would I do that?
And this is for embedded calls in video players/scripts...
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 %{HTTP_HOST} ^subdomain\.domain\.com$ [NC]
RewriteRule ^(.+)$ https://s3.amazonaws.com/whatever/$1 [R=301,L]
Assuming you have a dedicated folder for the subdomain, you would just need the following rule:
RedirectMatch 301 /(.*) https://s3.amazonaws.com/whatever/$1