I want to show this URL:
http://test.test/htaccess/City/msh/thr/
to access this:
htaccess.php?method=City&city=mashhad&endcity=tehran
I tried the code below, but it does not work:
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>