Jump to content

No Indexes Redirect


Recommended Posts

hmmm.... doesn't seem to work.

 

This is on a sub-domain, and I want to redirect to my "main" domain. The sub-domain has all the images user upload, none of the directories have index files, so if they don't hit a file directly, such as a jpg it needs to redirect them to the main site.

 

I don't know if that helps at all, but the code you gave doesn't redirect me at all (even after changing / to http://mysite.com)

Link to comment
Share on other sites

The second half of the RewriteRule is the path you will be redirected to. In the case of requinix's code / represents document root. If the .htaccess file is on a sub-domain this will refer to the document root of the sub-domain. If you wish to go to the home page of main domain, just swap the forward slash out with your domain name.

 

RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ http://www.mysite.com/[L,R]

Link to comment
Share on other sites

It was purely a hypothesis, I'm not entirely surprised it didn't work, though I couldn't tell you the reason, I was just making a suggestion on the solution you'd already tried. You could just check if the requested path ends with a forward slash.

 

RewriteRule /$ http://hostbox.us/ [L,R]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.