为该链接创建SEO URL?

时间:2017-11-02 09:10:52

标签: php .htaccess

伙计们我有这个链接:

http://kika-makeup.dev.extensa.bg/index.php?route=information/information

如何成为该链接:

http://kika-makeup.dev.extensa.bg/information

我试过这个:

RewriteEngine on
RewriteRule ^/information/([0-9]+)$ /index.php?route=information/information

1 个答案:

答案 0 :(得分:0)

这就是为什么你的正则表达式不匹配的原因:

RewriteRule ^/information/([0-9]+)$ /index.php?route=information/information
             ↑               ↑
   leading slash          There's no numbers in your
  does not match          shortened input path.
    in .htaccess          »http://example/information«

由于您没有提供更多详细信息,这只是关于如何在内部重写您的一个输入路径的示例:

RewriteRule ^(information)$ index.php?route=information/$1

有关如何匹配内容的更多示例,请参阅Reference: mod_rewrite, URL rewriting and "pretty links" explained