Writing .htaccess to redirect only the index page

How can I write .htaccess to redirect only the index page to a different url, allowing the rest of the pages behind index to  render without redirecting?
3rdLifeWebDevAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Steve BinkConnect With a Mentor Commented:
There are two ways:

1) If your index page is found as a result of DirectoryIndex, you can just set a new DirectoryIndex value in your .htaccess file.  

2) Using mod_rewrite for a specific file:
RewriteEngine On
RewriteRule ^/?index.php$ /some-other-page.php [NC]

Open in new window

If your replacement page is above or outside the current directory, you may need to set RewriteBase as well.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.