Jump to content

Recommended Posts

Posted

I know there is a way to redirect to a index.htm or index.php or whatever using .htaccess file. I want to redirect from www.mysite.com to www.mysite.com/blog/ instead. I couldn't find the post I saw many moons ago in the forums, so I hope someone here can remember what the steps were for doing it.

 

Thanks,

Mav

Posted

edit your .htacess and put a line like this:

 

DirectoryIndex other_index.html

 

where 'other_index.html' is the name of the file you want as your starting page. The downside is that this affects every subdirectory too. For example, my first page was named 'main.html' and the server expected it to be index.html. My .htaccess file was edited to say:

 

DirectoryIndex main.html

 

and that worked great, until someone went to www.mysite.com/subdirectory. In that subdirectory, the server would not recognize index.html as the main page. It was looking for main.html as specified in my .htaccess file. So, what you do is add a 2nd option in there, like:

 

DirectoryIndex main.html index.html

 

Meaning the server first looks for main.html, and if that's not found it looks for index.html. You can also add other entries too. I've not tried, but I assume that if you wanted www.yersite.com/blog/index.html as your starting page, you could do something like:

 

DirectoryIndex blog\index.html

 

But you might have to mess with the syntax to get it right (\blog\index.html or .\blog\index.html, etc)

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...