Answer the question
In order to leave comments, you need to log in
How to make /123 seen by Apache as /index.php?name=123?
There are index.php, ads.php and about.php pages and using .htaccess the .php extension is hidden like this:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule (.*) $1.php
RewriteCond %{REQUEST_FILENAME}.php !-f
the request /hahah and /asdjf are perceived as /index.php?name=hahah and /index.php?name=asdjf respectively. I tried with code like this:RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule (.*) $1.php
RewriteCond %{REQUEST_FILENAME}.php !-f
RewriteRule (.*) index.php?name=$1
Answer the question
In order to leave comments, you need to log in
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)$ index.php?name=$1 [L,QSA]
# и тд если надо
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/([^/]*)$ index.php?name=$1&sub_name=$2 [L,QSA]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question