Solved

Writing .htaccess to redirect only the index page

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
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…

773 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