Home problem with url rewrite .htaccess
Reply: 0

problem with url rewrite .htaccess

user4368 Published in September 19, 2018, 3:57 am

I'm writing a mvc framework in php, and trying to rewrite urls using this pattern:


to read as


So I can explode the $_GET['url'] var and use into the fw to route.

Its working great in almost any case, the only issue is that when I try to use a string that is a folder too, ak 'admin', without a trailing slash, the url exposes the variables.

Like this:

www.example.com/admin/ - OK, the url stays just like that

www.example.com/admin - Heres the problem, the url redirects browser to:


The $_GET['url'] is set and working ok in both cases, but I wish to doesnt expose the 'url=admin'.

Theres any way to do that?


The .htaccess is:

RewriteEngine On

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

RewriteCond %{SCRIPT_FILENAME} -d RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^(.*)$ index.php?url=$1 [PT,L]

share|improve this question

1 Answer 1

active oldest votes
up vote 1 down vote
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.322786 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO