I'm fairly new to htaccess, so if this is a noob question I apologize.
Recent I launched a newly designed website, and created 301 redirects for all of the old pages.
An example of one of the redirects is:
redirect 301 /about-busch-systems.html http://www.buschsystems.com/About/The-Busch-Company.php
The url:
"redirect 301 /about-busch-systems.html http://www.buschsystems.com/About/The-Busch-Company.php"
is in actuality:
"http://www.buschsystems.com/index.php?p=About&subPage=The-Busch-Company"
The redirect is sending me to the right page, with the proper URL, except the old page is being strung on the end as a variable.
Example:
redirect 301 /about-busch-systems.html http://www.buschsystems.com/About/The-Busch-Company.php
Sends me to "http://www.buschsystems.com/About/The-Busch-Company.php?p=about-busch-systems
Any ideas of why this is happening?
Thanks in advance!
Because that is what Redirect is supposed to do:
Then any request beginning with URL-Path will return a redirect request to the client at the location of the target URL. Additional path information beyond the matched URL-Path will be appended to the target URL.
Use RedirectMatch if you want more control.
Related
I have two domains - https://hosting.opensimcity.org, and http://paradigm.pocketmud.com and I want to redirect the latter to the former. That is, when someone connects to http://paradigm.pocketmud.com I want it to redirect to https://hosting.opensimcity.org/paradigm
Any tips on doing this in my .htaccess file?
Just try the following htaccess redirect code:
Redirect 301 / https://hosting.opensimcity.org/paradigm
This 301 redirect response notifies the search engines that the page has moved permanently from the old URL to the new URL. The search engines also transfer the old URL page rank to the new URL.
I originally asked a .htaccess question here and got some awesome help, which worked a treat. Basically, I'm trying to redirect pages from an old site to a new site, and have managed to make most things work. However, there's a couple of links in Google's search results that aren't redirecting properly, and I believe this is because they're all www and the new site redirects to non-www. For example, a link like this in the search engine results:
www.example.com/Expertise/ProductTesting
Should go to:
example.com/services/product-testing
But instead goes to:
example.com/services/ProductTesting
So for some reason the last part of the URL isn't changing. Here's how that line looks in my .htaccess:
RedirectMatch 301 ^/Expertise/ProductTesting/?$ /services/product-testing/
If I type the address in manually and drop the www, it redirects as it should.
Thanks in advance!
Taking your previous question into consideration, you must put your new rule before the one that is matching everything: RedirectMatch 301 ^/Expertise/(.*)$ /services/$1.
Also, you'll maybe have to clear your browser's cache before trying again (or try it with another browser).
Your rules should look like this
RedirectMatch 301 ^/Expertise/QuantitativeResearch/?$ /services/quantitative-research/
RedirectMatch 301 ^/Expertise/ProductTesting/?$ /services/product-testing/
RedirectMatch 301 ^/Expertise/(.*)$ /services/$1
I need to create a few 301 redirects for a site, basically I need to redirect the following URL :
http://www.oldsite.com/en-gb/resources/ks2/
to
http://www.newsite.com/resources/ks2/
I think the following should be sufficient, can anyone confirm this
Redirect 301 http://www.oldsite.com/en-gb/resources/ks2/ http://www.newsite.com/resources/ks2/
Does this look correct? As it scanned by Google's bot I want to get it correct first time round, thanks in advance
P.S What is the best way/resource people use to confirm their 301 redirects are correctly setup?
Your rule is incorrect since you only match Request URI in the rule. Also better to use RedirectMatch for regex capabilities:
RedirectMatch 301 ^/en-gb/(resources/ks2/?)$ http://www.newsite.com/$1
All the urls of our site are written www.mydomain.com/sub1/cms/pagename
Through the CMS we can specify pagename
sub1 and cms are not actually directories on the server.
We need to change the pagenames to be more SEO friendly, but we still want any traffic to the old pagename to direct to the new one.
I have tried making an .htaccess file specifying:
Redirect 301 /sub1/cms/oldpagename mydomain.com/sub1/cms/newpagename
but it does not work.
I have been successful with:
Redirect 301 /oldpagename mydomain.com/sub1/cms/newpagename
Can this be done somehow through .htaccess?
First, make sure your 301 redirect rules for redirect use a full url including the http:// portion.
Redirect 301 /sub1/cms/oldpagename http://mydomain.com/sub1/cms/newpagename
Second, it sounds to me like your CMS has put a rewrite rule in place to handle the /sub1/cms/pagename style urls. If this rule comes before your redirect, your redirect will never get triggered. Try moving your redirect to the top of the .htaccess file.
Hey I'm just setting up a few 301 redirects but I can't work out how to do this particular function.
I have a ton of pages on my existing site e.g.
/products/23
/products/3
/products/57
/products/36
..etc
That I all want to point to one page on a new domain .e.g.
http://www.mynewdomain.com/store
I've tried a few RewriteRules with no success!
Thanks for any help !
It should work with a RedirectMatch directive (although you don't specify in your question how to pass the product codes to the new page):
RedirectMatch301 ^/products/(.*) http://www.mynewdomain.com/store/$1
This rule will redirect /products/NNN to http://www.mynewdomain.com/store/NNN (with HTTP status code 301).