【问题标题】:php .htaccess clean urlphp .htaccess 干净的网址
【发布时间】:2014-12-08 07:21:39
【问题描述】:

xxx.com.com/front

Array ( [mod] => home  )

xxx.com/news-my-seo-title

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

xxx.com/cat-mycategory-1

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

我需要像这样的回报

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

我犯了什么错误,因为这是我第一次做首页工作,所以我需要一个干净的网址

顺便说一下,这是我的 .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>

希望有人可以帮助我,非常感谢,如果有链接或任何我可以阅读的内容,请给我链接。 附加信息我的 seo 标题格式像这样(破折号分隔)

this-is-seo-title

感谢之前

【问题讨论】:

  • 尝试在两个规则中将[^-].* 更改为[^-]*
  • 它的工作非常感谢第一条规则它不起作用所以我使用旧的

标签: php .htaccess clean-urls


【解决方案1】:

你可以使用这个.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]

无法使用[^-]*,因为您在seo 标题中使用了-

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-10-21
    • 2011-06-25
    • 2013-06-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多