?
Solved

Writing .htaccess to redirect only the index page

Posted on 2014-12-16
3
Medium Priority
?
116 Views
Last Modified: 2016-05-13
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?
0
Comment
Question by:3rdLifeWebDev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 51

Accepted Solution

by:
Steve Bink earned 2000 total points
ID: 40504801
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

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Make the most of your online learning experience.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Starting up a Project
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question