简体   繁体   中英

Make a specific URL redirect to the correct folder using .htaccess

I was wondering if it would be possible to redirect a URL specifically set inside .htaccess to redirect to the correct folder where my application files are located? What I did so far in my .htaccess file looks like this,

Options -Indexes

RewriteBase /mainfolder/cakephpfolder/

Options +FollowSymlinks
RewriteEngine on
RewriteRule    ^$ app/webroot/    [L]
RewriteRule    (.*) app/webroot/$1 [L]

and what I would like is when I use this url http://www.mysamplesite.org/desired/url it will use the files which are located in /mainfolder/cakephpfolder/ . Basically, I want to mask my previous my url which looks like http://www.mysamplesite.org/mainfolder/cakephpfolder and make it look like with my desired url. Is that possible? Thank you so much.

尝试类似:

RewriteRule ^desired/url$ /mainfolder/cakephpfolder/ [NC,L]

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