Anand Solanki
Anand Solanki

Reputation: 3425

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.

Upvotes: 2

Views: 426

Answers (2)

jewelhuq
jewelhuq

Reputation: 1203

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

it will redirect you to your site.

Upvotes: 0

anubhava
anubhava

Reputation: 785276

Place this rule in DocumentRoot/.htaccess file:

RewriteEngine On

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

Upvotes: 2

Related Questions