Solved

.htaccess Redirect Question

Posted on 2012-04-13
4
192 Views
Last Modified: 2012-04-16
Greetings

I have a folder on my web site - let's call it /docs.

I need to be able to redirect requests "permanently" for "http://mydomain.com/docs/" to "http://mydomain.com/docs/special-page.html". But I don't want it to effect requests for other pages in that folder e.g. "http://mydomain.com/docs/page1.html" etc

I tried:
redirect 301 /docs/ http://mydomain.com/docs/special-page.html
But that DID seem to mess up access to the other pages!
0
Comment
Question by:PaliTree
[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
  • 2
4 Comments
 
LVL 17

Expert Comment

by:Anuroopsundd
ID: 37843062
0
 

Author Comment

by:PaliTree
ID: 37843177
Anuroopsundd - that's a link, not an answer. Note: I am NOT redirecting to another folder. I am redirecting requests for the folder (/docs/) to a file within that folder.

To repeat: redirect 301 /docs/ http://mydomain.com/docs/special-page.html does not seem to work.
0
 
LVL 26

Accepted Solution

by:
arober11 earned 250 total points
ID: 37848601
You don't need a redirect; easiest solution would be to rename special-page.html  to index.html. This should result in the page being served when q request for the /docs/ directory turn's up.

Alternatively you could add special-page.html to the DirectoryIndex directory in either the httpd.conf or .htaccess file e.g.

DirectoryIndex index.html special-page.html

Open in new window


to achieve the same result.

Or you could add a rewrite rule along the following lines:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .*   http://mydomain.com/docs/special-page.html  [L,R=301]

Open in new window

0
 

Author Comment

by:PaliTree
ID: 37850460
Many thanks arober11! I've used the "DirectoryIndex" solution.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

622 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