user5639310
user5639310

Reputation:

url rewrite issue by .htaccess

I have issue on url rewrite i am want to change url

http://www.example.com/mbl.php?domain=example.com to http://www.example.com/mbl/example.com

So i have written code myself by as below

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^/mbl/([^/]+)$ /mbl.php?domain=$1

But its not working. so please to my error.

Thanks

Upvotes: 1

Views: 26

Answers (1)

Panama Jack
Panama Jack

Reputation: 24478

You should try your rules this way and remove the leading slash from the rewriterule with mbl since you are using it in .htaccess file.

Give these rules a try.

#Options -MultiViews
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteRule ^mbl/([^/]+)$ /mbl.php?domain=$1 [L]

RewriteRule ^([^\.]+)$ $1.php [NC,L]

Upvotes: 1

Related Questions