Forum Moderators: phranque

Message Too Old, No Replies

Help with GoDaddy and mod rewrite.

mod_rewrite godaddy

         

zipper1976

7:20 pm on Feb 14, 2011 (gmt 0)

10+ Year Member



I have a GoDaddy account with a directory structure something like this...

/root <--- mymaindomainname.com points here
/root/other <--- a sub-directory
/root/blog <--- myblogdomainname.com points here
/root/blog/wp <--- wordpress installed in this sub-directory

So, to access my blog, a user enters
"http://myblogdomainname.com/wp/".

I am trying to use mod_rewrite to make it so a user only has to enter "http://myblogdomainname.com/". I found several postings on the web which suggest that I create a .htaccess file with the following:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?myblogdomainname.com$
RewriteRule ^(/)?$ wp [L]

I have placed this .htaccess in /root/blog. But when I try to access my blog using "http://myblogdomainname.com/" I get a 404. All I can figure out is that I think the problem has something to do with the fact that myblogdomainname.com is pointing at a sub-directory in my GoDaddy account, and not the root folder.

When, as a test, I added a .htaccess to my /root folder as follows...

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?mymaindomainname.com$
RewriteRule ^(/)?$ other [L]

... the rewrite worked fine.

Is there anything obvious that I am missing here?

zipper1976

1:50 pm on Feb 15, 2011 (gmt 0)

10+ Year Member



OK. I appear to have solved my problem. Apparently the RewriteRule for a GoDaddy sub-directory should be...

RewriteRule ^(/)?$ /wp [L]

The leading '/' is needed here.

jdMorgan

11:29 pm on Feb 17, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The parentheses are not needed here, since only the single character "/" is optional.

Jim