Home › Forums › BulletProof Security Pro › Go Daddy Redirect htaccess code no longer working
Tagged: Go Daddy, GoDaddy, Redirect, RedirectMatch
- This topic has 4 replies, 2 voices, and was last updated 11 years, 7 months ago by
bill.
-
AuthorPosts
-
AITpro Admin
KeymasterGo Daddy recently (7-10-2013 to 7-17-2013) made some Server changes that affect aliased domains when using RedirectMatch .htaccess code to create .htaccess redirects.
Let’s say you have a website installed in a folder named “/mydomain.com” (a good naming convention for additional domains that are added under your hosting account is to use the domain name for the folder name. If you used another folder name that is not based on the domain name then use the folder name. Example: /myFolderName/wordpress/). This particular site is aliased to the primary domain for the hosting account…
/mydomain.com
…and your actual WordPress site is installed in this folder…
/mydomain.com/wordpress/
…You will now need to include the “/mydomain.com” folder name in the RedirectMatch rule in order for the redirect to work.
Old RedirectMatch rule that no longer works
RedirectMatch 301 ^/wordpress/installation-videos/sign-installation-videos-vehicle-graphics-installation-videos/$ http://www.example.com/wordpress/category/signs-graphics-wraps/vehicle-graphics/
New RedirectMatch rule that does work
Note: /mydomain.com/ is the actual folder name where the site is added/exists and is not the URL for the domain.RedirectMatch 301 ^/mydomain.com/wordpress/installation-videos/sign-installation-videos-vehicle-graphics-installation-videos/$ http://www.example.com/wordpress/category/signs-graphics-wraps/vehicle-graphics/
AITpro Admin
KeymasterOk so now for a tricky one. How do you do a redirect for a subdomain site. This one should mess with your head a bit. 😉 The confusing part is the use of “forum” and “forums” with an “s”. They are 2 completely different things.
This Forum is installed in a folder named “/forum/” and this Forum is a subdomain site with a DNS A record pointing to the “/forum/” folder. “forums” with an “s” just happens to be the standard/default URL base for BuddyPress/bbPress. Once again 2 completely different things.
A 404 error was occuring for this URL: http://forum.ait-pro.com/activity/p/6886/
So by following the logic that worked for aliased subfolder sites and other aliased site variations this is the RedirectMatch rule that should work and it does work, which you can verify by clicking the link above. It will redirect back to this Forum post.
RedirectMatch 301 ^/forum/activity/p/6886/$ http://forum.ait-pro.com/forums/topic/go-daddy-redirect-htaccess-code-no-longer-working/
Update: 12-5-2016
We recently made this forum site HTTPS/SSL and ran into some other Rewrite|Redirect issues. To Redirect the URL above this new RedirectMatch code was needed due to the way%{REQUEST_URI}
is interpreted by Go Daddy during http to https Rewriting.RedirectMatch 301 ^/forum/forum/activity/p/6886/$ https://forum.ait-pro.com/forums/topic/go-daddy-redirect-htaccess-code-no-longer-working/
Another example:
Old RedirectMatch code that no longer works
RedirectMatch 301 ^/forums/topic/alexa-certify-gets-403-errors/$ http://forum.ait-pro.com/forums/topic/alexa-certify/
New RedirectMatch code that does work
RedirectMatch 301 ^/forum/forums/topic/alexa-certify-gets-403-errors/$ http://forum.ait-pro.com/forums/topic/alexa-certify/
bill
ParticipantHi, AITpro.
Great post. I too have GoDaddy hosting and I was attempting to insert redirect coding this past weekend to no avail. On the surface, what I’m attempting to do is simple enough:
redirect POST
http://mysite.com/2013/07/relevant
to PAGEhttp://myothersite.com/relevant-also/
. The finished product looked like this:Redirect 301 /2013/07/relevant http://myothersite.com/relevant-also/
Side Notes: My POST site’s directory name is: TITO (my PAGE site’s directory is different) and I inserted the code under the “CUSTOM CODE BOTTOM HOTLINKING/FORBID COMMENT SPAMMERS/BLOCK BOTS/BLOCK IP/REDIRECT CODE: Add miscellaneous code here” section of the .htaccess file.
Thanks,
-BillAITpro Admin
KeymasterYou now have to include the folder name where the website is installed/exists in your Redirect code. RedirectMatch is much better to use over just plain Redirect. The reason for this is RedirectMatch allows you to use Regular Expression code and Redirect does not allow that.
This is what your redirect rule should look like.
RedirectMatch 301 ^/folder-name-where-your-website-is-installed-goes-here/2013/07/relevant/$ http://myothersite.com/relevant-also/
bill
ParticipantThat code worked perfectly! Thanks! I’m still running into a small issue however… When I do my “regular site” test with the above redirect code, it works wonderfully. When I test it via this new webapp (convert your wordpress site into an app) plugin I’m also testing, that page appears blank. Now, I know the code works like a charm because I tested it on my PC. Its clearly something with the webapp plugin…
-
AuthorPosts
- You must be logged in to reply to this topic.