Solved

Writing .htaccess to redirect only the index page

Posted on 2014-12-16
3
109 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 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
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…

695 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