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
Solved

Writing .htaccess to redirect only the index page

Posted on 2014-12-16
3
93 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
3 Comments
 
LVL 50

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
It’s a strangely common occurrence that when you send someone their login details for a system, they can’t get in. This article will help you understand why it happens, and what you can do about it.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
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…

856 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