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

I have many redirects working but I have one that needs to be redirected and drop the file name.

redirect 301 /path/to/file/default.aspx http://www.domain.com/newpath/to/page/

When I implement this it tries to redirect but it does not drop the default.aspx from the URL.

Edit
Rewrite Rules:

 ## path relative to web root
 RewriteBase /

 ## workaround for HTTP authorization
 ## in CGI environment
 RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

 ## always send 404 on missing files in these folders
 RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

 ## never rewrite for existing files, directories and links
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-l

 ## rewrite everything else to index.php
 RewriteRule .* index.php [L]

EDIT 2
The only other directives would be in the vhost config and there is not alot there:

<VirtualHost 192.168.100.216:80>
ServerName web01.domain.com
ServerAlias www.domain.com
DocumentRoot /var/www/domain.com/htdocs
SetEnvIf X_FORWARDED_PROTO https HTTPS=on
RewriteEngine on
<Directory /var/www/domain.com>
AllowOverride All
</Directory>
</VirtualHost>
share|improve this question
2  
That directive shouldn't result in the behaviour you see, are there any other Redirect directives which are relevant? –  mgorven Mar 15 '13 at 22:25
1  
Please edit your question when adding additional details instead of using comments. –  mgorven Mar 15 '13 at 22:26

1 Answer 1

The documentation for Redirect says that

Additional path information beyond the matched URL-path will be appended to the target URL.

so your Redirect line is appending the unwanted filename.

Try this instead:

RewriteCond %{REQUEST_URI} ^/path/to/file/default.aspx$
RewriteRule .* http://www.domain.com/newpath/to/page/
share|improve this answer
    
Thanks, but unfortunately this did not fix the redirect. It still takes me to the site root. –  Jesse Mar 18 '13 at 17:01

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.