简体   繁体   中英

Remove last directory from URL using htaccess

My question is, How can remove last directory using htaccess rule.

http://mywedding.com/anandn/
should load content of
http://mywedding.com/anandn/theme/

OR

http://mywedding.com/mamtaandkuldip/
should load content of
http://mywedding.com/mamtaandkuldip/theme/ 

Thanks in advance.

Place this rule in DocumentRoot/.htaccess file:

RewriteEngine On

RewriteRule ^([^/.]+)/?$ /$1/theme/ [L]

Inside mywedding.com/anandn/index.php write the following code header("location:mywedding.com/anandn/theme/");

it will redirect you to your site.

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