.htaccess - Convert ugly urls to user friendly urls -


in website there lot of ugly urls , need rewrite them nice user friendly urls.

these of ugly urls website :

http://www.mydomain.com/profiles/tutors/index.php?code=1285&name=ricky+pointing http://www.mydomain.com/profiles/centers/index.php?code=2285&name=city+&+gills http://www.mydomain.com/about.php http://www.mydomain.com/contact.php.... , more 

so looking nice user friendly solution above ugly urls, :

http://www.mydomain.com/tutors/ricky_pointing.html http://www.mydomain.com/centers/city_&_gills.html http://www.mydomain.com/about.html http://www.mydomain.com/contact.html 

i tried similar in .htaccess file..

rewriteengine on  rewritecond %{the_request} ^[a-z]{3,9}\ /profiles/tutors/index.php\?code=([0-9]+)&name=([^&]+)&?([^\ ]+) rewriterule ^profiles/tutors/index\.php /%1/%2/?%3 [r=301,l,ne]  rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([0-9]+)/(.+)/$ /profiles/tutors/index.php?code=$1&name=$2 [l,qsa] 

but still no luck. can me this? thank you.

i think might overcomplicating rewriteconds , such. you'll have rules this:

rewriterule ^about\.html$ about.php [l] rewriterule ^contact\.html$ contact.php [l] rewriterule ^tutors/(.*)\.html$ /profiles/tutors/index.php?name=%1 [l] rewriterule ^centers/(.*)\.html$ /profiles/centers/index.php?name=%1 [l] 

you'll have modify php scripts appropriate thing name without relying on having code present. it'll have deal presence of underscores existed in original url.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -