Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress 重写Url在htaccess中不起作用_Wordpress_.htaccess_Codeigniter_Url Rewriting_Cakephp 2.0 - Fatal编程技术网

Wordpress 重写Url在htaccess中不起作用

Wordpress 重写Url在htaccess中不起作用,wordpress,.htaccess,codeigniter,url-rewriting,cakephp-2.0,Wordpress,.htaccess,Codeigniter,Url Rewriting,Cakephp 2.0,我想将我的网站的URL结构更改为。但它不适用于SSl站点 我的代码是: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteRule ^/postdetail/([0-9]+)$ /post-detail.php?post-id=$1 在.htaccess中url的开头没有/个字符 你快到了。url开头的/永远不会匹配,尽管它在httpd.

我想将我的网站的URL结构更改为。但它不适用于SSl站点

我的代码是:

Options +FollowSymLinks -MultiViews
  # Turn mod_rewrite on
  RewriteEngine On
  RewriteBase /
  RewriteRule ^/postdetail/([0-9]+)$ /post-detail.php?post-id=$1
在.htaccess中url的开头没有/个字符

你快到了。url开头的/永远不会匹配,尽管它在httpd.comf中会匹配。尝试:


您的重写规则似乎适用于此urlhttps://www.compareking.no/postdetail/1 删除帖子id或尝试此重写规则^/postdail/post id/[0-9]+$/post detail.php?帖子id=$1@ASR我试过你的方法。但不是工作。如果您有其他解决方案,请让我知道。我尝试过,但不起作用。和.htaccess文件正在工作。我已经从url中删除了.php,这很有效。
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule postdetail/([0-9]+)/?$ post-detail.php?post-id=$1 [B,QSA,L]