简体   繁体   中英

Convert URLs to SEO friendly urls

How can I convert my urls to SEO friendly URLS using .htaccess ?

the orginal url like this :

http://palestinianz.com/?page=person&p=10

and

http://palestinianz.com/?page=persons&c=10

the rewritten URL for the first link is :

RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)\.html$ /?page=$1&p=$2 [L]

the result of the first link :

http://palestinianz.com/person/10.html

how can I write a redirect rule to the rewritten url !

It looks like you need to apply my previous answer , changing the person to persons and the p to c :

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /\?page=persons&c=([^\ ]+)
RewriteRule ^$ /persons/%1.html? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /\?page=person&p=([^\ ]+)
RewriteRule ^$ /person/%1.html? [R=301,L]

and back

RewriteRule ^persons/([^/]*)\.html$ /?page=persons&c=$1 [L]
RewriteRule ^person/([^/]*)\.html$ /?page=person&p=$1 [L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM