php - how to rewrite url for this query string url in htaccess -


i have tried many rewrite rules following url didn't success.i researched lot , wasted 2 days.

i need url need rewrite url from

http://localhost/tour/tour.php?page=golden-triangle-tour

to

http://localhost/tour/tour/golden-triangle-tour

please guide me fix in htaccess.

you can use code in /tour/.htaccess file:

rewriteengine on rewritebase /tour/  # external redirect actual url pretty 1 rewritecond %{the_request} /tour\.php\?page=([^\s&]+) [nc] rewriterule ^ tour/%1? [r=302,l,ne]  rewritecond %{the_request} /tour/(.+?)\.php[\s?] [nc] rewriterule ^ %1 [r=302,l,ne]  # internal forward pretty url actual 1 rewriterule ^tour/([^/.]+)/?$ tour.php?page=$1 [l,qsa,nc]  # internally forward /dir/file /dir/file.php rewritecond %{request_filename} !-d rewritecond %{document_root}/toure/$1\.php -f [nc] rewriterule ^(.+?)/?$ $1.php [l] 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -