Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm looking for a htaccess redirect (not rewrite) which will redirect this:

site.com/./everything

To

site.com/

So, everything can be anything, like /./script.php or /./path/to/script.php.

I only want to redirect if there is the /./ slash dot slash. How can I do this without using mod_rewrite?

share|improve this question
    
why don't you want to use mod_rewrite? –  Andbdrew Mar 30 '12 at 18:30
1  
If you can't use mod_rewrite, which modules can you use? There is no native support for redirects, you have to use a module. –  Chris S Mar 30 '12 at 18:33
    
Unfortunately mod_rewrite wasn't included when Apache installed so can't use it. Is there a way of doing it with the Redirect directive? –  ServerBloke Mar 30 '12 at 18:36
    
@John See my previous comment. Without that information we can not help you. Redirect is part of mod_alias, was that installed??? –  Chris S Mar 30 '12 at 18:41
    
@ChrisS I am only certain that mod_rewrite is missing. How can I verify if mod_alias is there? –  ServerBloke Mar 30 '12 at 18:45
show 2 more comments

1 Answer

up vote 1 down vote accepted

You can do this without mod_rewrite by using RedirectMatch from mod_alias instead:

RedirectMatch 301 ^/\./(.*)$ http://site.com/

The ^/\./ part of the regex matches the leading dot slash and the (.*)$ part collects everything else (if anything) until the end and throws it away.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.