重写Url在htaccess中不起作用

时间:2014-07-11 05:02:51

标签: wordpress .htaccess codeigniter url-rewriting cakephp-2.0

我想将https://www.compareking.no/post-detail.php?post-id=1的网站网址结构更改为https://www.compareking.no/postdetail/post-id/1。但它不适用于SSl网站

我的代码是:

Options +FollowSymLinks -MultiViews
  # Turn mod_rewrite on
  RewriteEngine On
  RewriteBase /
  RewriteRule ^/postdetail/([0-9]+)$ /post-detail.php?post-id=$1

1 个答案:

答案 0 :(得分:0)

/

中的网址开头没有.htaccess

你快到了。您网址开头的/将永远不会匹配(尽管它会在httpd.comf中)。尝试:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule postdetail/([0-9]+)/?$ post-detail.php?post-id=$1 [B,QSA,L]