Hide file extensions
7 posts
• Page 1 of 1
Hide file extensions
Hi
I read this page:
http://www.helicontech.com/isapi_rewrit ... amples.htm
in order to hide asp extensions of files. I need this file
http://www.mysite.com/file.asp
to be rewritten this way:
http://www.mysite.com/file/
but http://www.mysite.com/file.asp should remain accessible if someone calls this url
Which is the right way to do that?
Thanks
I read this page:
http://www.helicontech.com/isapi_rewrit ... amples.htm
in order to hide asp extensions of files. I need this file
http://www.mysite.com/file.asp
to be rewritten this way:
http://www.mysite.com/file/
but http://www.mysite.com/file.asp should remain accessible if someone calls this url
Which is the right way to do that?
Thanks
Re: Hide file extensions
Hello,
it should be like this:
RewriteBase /
RewriteRule ^(.+)\.asp$ /$1/? [NC,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ /$1.asp [NC,L]
it should be like this:
RewriteBase /
RewriteRule ^(.+)\.asp$ /$1/? [NC,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ /$1.asp [NC,L]
Re: Hide file extensions
Thanks for your reply
It works but now it's not accessible with http://www.mysite.com/file.asp, but only with http://www.mysite.com/file/
Is it possible to have both?
thanks
It works but now it's not accessible with http://www.mysite.com/file.asp, but only with http://www.mysite.com/file/
Is it possible to have both?
thanks
Re: Hide file extensions
"Is it possible to have both?"
- how do you see that?
You request:
- http://www.mysite.com/file.asp to be rewritten this way: http://www.mysite.com/file/
- but http://www.mysite.com/file.asp should remain accessible
Isn't it a little contradictory? Can't imagine how to have both. If you could clarify, I might help.
- how do you see that?
You request:
- http://www.mysite.com/file.asp to be rewritten this way: http://www.mysite.com/file/
- but http://www.mysite.com/file.asp should remain accessible
Isn't it a little contradictory? Can't imagine how to have both. If you could clarify, I might help.
Re: Hide file extensions
eheheheh you are right Anton, it can seems contradictory...
But now I have an environment where this is possible, and I have to replicate it the same way on another oone. I use the same .htaccess, but on the other one it doesn't work.
Maybe it's something IIS related and not isapi related
Thanks
But now I have an environment where this is possible, and I have to replicate it the same way on another oone. I use the same .htaccess, but on the other one it doesn't work.
Maybe it's something IIS related and not isapi related
Thanks
Re: Hide file extensions
Try:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ /$1 [R=permanent,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.asp -f
RewriteRule ^(.+)$ $1.asp [L,QSA]
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ /$1 [R=permanent,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.asp -f
RewriteRule ^(.+)$ $1.asp [L,QSA]
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 12 guests