Answer the question
In order to leave comments, you need to log in
Why can't I make a nice mod_rewrite link?
http://blog/view/site/home.php
I'm doing it
on the local host, there is a site, through a bunch of folders a view, now after entering the site the link is this blog/home
:
RewriteEngine On
- RewriteRule ^/view/site/home.php$ test.php
- RewriteRule ^/view/site/home.php$ index.php
- RewriteRule ^/view/site/home.php$ home [L,QSA,NC]
- RewriteRule ^/view/site/home.php$ home.php
- RewriteRule ^view/site/home.php$ home.php [L,QSA,NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
^
will be changed to what comes after php$
in our change, and the array is the parameters by which the conversion takes place, but I don’t understand something exactly how it works out ... Answer the question
In order to leave comments, you need to log in
how many have not sat on the toaster, but have not seen this one ..
You thoroughly need to read the mod rewrite.
# если это не ! директория
RewriteCond %{REQUEST_FILENAME} !-d
#И если не файл
RewriteCond %{REQUEST_FILENAME} !-f
# если в урле встречается /view/site что угодно+конец php
RewriteCond %{REQUEST_URI} ^/view/site/(.*)\.php&
# то выполнить условие $1 из реврайт когда будет %1
RewriteRule (.*) /blog/%1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question