简体   繁体   English

PHP .htaccess干净的网址

[英]php .htaccess clean url

xxx.com.com/front << work retuern xxx.com.com/front <<工作经历

Array ( [mod] => home  )

xxx.com/news-my-seo-title << work return xxx.com/news-my-seo-title <<工作回报

Array ( [mod] => cat [act] => more [seo] => hiburan-2 )

xxx.com/cat-mycategory-1 << not work return xxx.com/cat-mycategory-1 <<无效返回

Array ( [mod] => cat [act] => more [seo] => hiburan-2 )   

i need return like 我需要像

Array ( [mod] => cat [act] => more [seo] => hiburan [page]=> 2 )

what mistake i made, since this is my first time doing front page job so i need good clean url 我犯了什么错误,因为这是我第一次做首页工作,所以我需要一个干净的URL

by the way this is my .htaccess 顺便说一句,这是我的.htaccess

<IfModule mod_rewrite.c>
RewriteEngine on

RewriteRule ^front root.php?mod=home [L]
RewriteRule ^/?(news|sch|cat)-([^-].*)$ root.php?mod=$1&act=more&seo=$2 [L]
RewriteRule ^/?(news|sch|cat)-([^-].*)-([0-9]+)$ root.php?mod=$1&act=more&seo=$2&page=$3 [L]

Options All -Indexes
</IfModule>

hope some one could help me, many thank, and if there is link or any thing i can read please give me link. 希望有人可以帮助我,非常感谢,如果有链接或我可以阅读的任何内容,请给我链接。 additional info my seo title format like so (dash seperated) 其他信息我的seo标题格式如下(破折号)

this-is-seo-title

thanks before 之前感谢

You can use this .htaccess : 您可以使用以下.htaccess

Options All -Indexes
RewriteEngine on

RewriteRule ^front root.php?mod=home [L]
RewriteRule ^/?(news|sch|cat)-(.+)-(\d+)/?$ root.php?mod=$1&act=more&seo=$2&page=$3 [L]
RewriteRule ^/?(news|sch|cat)-(.+)/?$ root.php?mod=$1&act=more&seo=$2 [L]

It's not possible to use [^-]* because you use - in seo title. 无法使用[^-]*因为您在seo标题中使用-

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

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