简体   繁体   中英

using .htaccess to hide file url

I need some help figuring out how to write this .htaccess .

My file is in mywebsite/part5/thanksfordownload.html . How to use .htaccess to have url mywebsite/thankyoufordownload.html ?

I tried using this for the .htaccess but no dice. I tried uploading it both in the root and in the folder itself.

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ /part5/$1 [L]

Not sure what went wrong in this part, thanks for your views & comments in advance!

Ok so basically if you only want that rule - you'd want to do something like this -

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^thankyoufordownload.html$ /part5/thankyoufordownload.html [L]

Simply:

RewriteRule ^thankyoufordownload.html$ part5/thanksfordownload.html

This will only work for the example asked about.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM