Solved

.htaccess Redirect Question

Posted on 2012-04-13
4
184 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
  • 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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

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…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now