我想显示此网址:
http://test.test/htaccess/City/msh/thr/
访问:
htaccess.php?method=City&city=mashhad&endcity=tehran
我尝试了下面的代码,但它不起作用:
htaccess.php
<a href="htaccess.php?method=City&city=mashhad&endcity=tehran">City</a >
<a href="htaccess.php?method=Hotel&hotel=tehran">Hotel</a >
<?php
if(isset($_GET['method']) and $_GET['method'] == 'City')
echo 'City';
elseif(isset($_GET['method']) and $_GET['method'] == 'Hotel')
echo 'Hotel';
else
echo 'Nothing Choose';
?>
的.htaccess
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+)$ $1.php [L,QSA]
RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/([^/.]+)/?$ htaccess.php?method=City&city=mashhad&endcity=tehran [L]
RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/?$ htaccess.php?method=Hotel&hotel=tehran [L]
</IfModule>