Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have to write a redirect rule for the below condition. to

How can this be achieved using the .htaccess

I have the below set of codes using on the current .htaccess file. Please also suggest where to include your code.

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule ^api/rest api.php?type=rest [QSA,L]
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
    RewriteRule .* - [L,R=405]
    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule .* index.php [L]
share|improve this question
up vote 0 down vote accepted

This could be done using mod_rewrite, eg something like this:

RewriteEngine On
RewriteRule ^(.*)\.aspx(.*)$ /$1$2 [R=301,L]
share|improve this answer
Yes! I am using the mod_rewrite. But using the above rule lead me to the 404 page. – PHP Bugs Aug 30 '12 at 6:50
Do you mean that your browser gets properly redirected to, but that URL returns a 404? If so, then why would you want to redirect there? – brain99 Aug 30 '12 at 7:29
No redirection is happening here. My page stays at – PHP Bugs Aug 30 '12 at 7:43
I may have been a bit too quick, I just updated my answer. Could you try that variation instead? – brain99 Aug 30 '12 at 8:28
The result is same. The page is not redirecting. I have edited my question with the current .htaccess file. Please check these as well. – PHP Bugs Aug 30 '12 at 8:46

Your Answer


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.