301 Redirect to Default.aspx

I have tried to figure this out for myself, with no luck. I just don’t use .htaccess enough to learn all about mod rewrites. I went through this Apache help (http://httpd.apache.org/docs/2.2/rewrite/rewrite_guide.html), but still need your help.

I want to permanently 301 redirect http://www.thegolfstationfit.com and http://thegolfstationfit.com TO http://thegolfstation.retailtribe.com

Going to http://thegolfstation.retailtribe.com brings up
http://thegolfstation.retailtribe.com/pro/Default.aspx

My .htaccess file in the root of thegolfstationfit.com reads:

RedirectMatch 301 http://www.thegolfstationfit.com/(.*) http://thegolfstation.retailtribe.com//$1

and takes me to this page:
http://www.thegolfstationfit.com/Pro/ErrorPages/Maintenance.htm?aspxerrorpath=/pro/Default.aspx

What’s going on? Do I need a special “rewrite” rule because I am forwarding to a .aspx file?

Thanks,
Nathon

Nathon,

First, WELCOME to SitePoint’s Apache forum!

Congratulations on finding the correct Apache module to use for something so simple! I’m not sure how you got to using a mod_alias redirection by looking at mod_rewrite’s guide but it worked!

Well, almost. You don’t need to use a RedirectMatch as that just gets the regex engine involved. Just get into thegolfstationfit.com’s DocumentRoot and use Redirect 301 / http://thegolfstation.retailtribe.com/. The Redirect will retain the path/file for the redirection (and the query string is not affected at all).

Adding the pro/Default.aspx is something that the WinDoze box is doing. I don’t understand why the DocumentRoot request is redirected to the pro subdirectory but it’s safe to assume that Default.aspx is the equivalent of Apache’s DirectoryIndex directive (which you can hide with Apache).

Regards,

DK

DK, thank you for the fast and friendly response.

My htaccess now reads:

//301 Redirect Entire Directory
Redirect 301 / http://thegolfstation.retailtribe.com/
 

I’ve cleared my cache and uploaded the file to my root folder (/nfs/WWW_pages/mbkeller/thegolfstationfit.com). A screenshot of the directory is attached.

It’s still loading http://www.thegolfstationfit.com/Pro/ErrorPages/Maintenance.htm?aspxerrorpath=/pro/Default.aspx

.htaccess should take effect immediately, right?

Thanks,
Nathon

Nathon,

No worries, we’re a friendly lot around here!

[COLOR="Red"]#[/COLOR] 301 Redirect Entire Directory
Redirect 301 / http://thegolfstation.retailtribe.com/

I don’t believe that // is an acceptable way to comment the .htaccess file while I know that # and ; are often used.

PLEASE CONFIRM that you’re using an Apache web server (which version would also be a help). After all, aspx files are generally ONLY acceptable on M$ servers.

Correct, .htaccess (on an Apache server) is read for EVERY request so, if updated, the update is immediately in effect. Where’s the

Options -Indexes

That, in the server and virtualhost configuration file OR the .htaccess file, will prevent Apache from displaying the directory listing.

Regards,

DK

DK,

My .htaccess now reads:

Redirect 301 / http://thegolfstation.retailtribe.com/

But it still loads the error page…

I even moved all the files in the root dir to a subfolder! There’s nothing there but .htaccess

Thank you for helping.

Regards,

DK

DK, thank you for your help. You have put in far more time and thought than I would expect. You are an excellent moderator of sitepoint.

My solution is to transfer the domain away from Sonic.net to Godaddy.com . I know how to easily redirect a domain there - without the htaccess.

Thank you,
Nathon