简体   繁体   English

将 URL 转换为 SEO 友好的 URL

[英]Convert URLs to SEO friendly urls

How can I convert my urls to SEO friendly URLS using .htaccess ?如何使用 .htaccess 将我的网址转换为 SEO 友好的网址?

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 :第一个链接的重写 URL 是:

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 !如何将重定向规则写入重写的 url !

It looks like you need to apply my previous answer , changing the person to persons and the p to c :它看起来像您需要申请我以前的答案,改变了personpersonspc

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]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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