Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/266.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
Php 如何在htaccess中重写url,使用户经常使用url_Php_Wordpress_.htaccess - Fatal编程技术网

Php 如何在htaccess中重写url,使用户经常使用url

Php 如何在htaccess中重写url,使用户经常使用url,php,wordpress,.htaccess,Php,Wordpress,.htaccess,我在wordpress中有一个站点,其中一个页面根据其ID显示问题 http://example.com/index.php/question/?questionid=9&title='how-to-rewite-htaccess' 我是php的初学者,我无法绘制stackoverflow.com上的其他示例 这是我的.htaccess代码 <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule

我在wordpress中有一个站点,其中一个页面根据其
ID
显示问题

http://example.com/index.php/question/?questionid=9&title='how-to-rewite-htaccess'
我是php的初学者,我无法绘制stackoverflow.com上的其他示例

这是我的.htaccess代码

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

RewriteRule ^/question/([^/]*)/([^/]*)/$ /question/?questionid=$1&title=$2 [NC,L]

</IfModule>

重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
重写规则^/question/([^/]*)/([^/]*)/$/question/?questionid=$1和title=$2[NC,L]

但这是行不通的。请告诉错误在哪里。

由于您使用的是Wordpress,您可以打开永久链接,它可以为您查看url友好的url


登录您的管理员,然后转到永久链接并设置首选样式。

由于您使用Wordpress,您可以打开永久链接,它可以为您查看url友好的url


登录您的管理员,然后转到永久链接并设置首选样式。

一旦您转到设置>永久链接并设置漂亮链接,WordPress将根据您选择的设置自动生成.htaccess。别忘了存钱


更多信息请参见此处

一旦您进入设置>永久链接并设置漂亮链接,WordPress将根据您选择的设置自动生成.htaccess。别忘了存钱


此处的详细信息

example.com/index.php/question/9/如何重新连接htaccess
与您的重写规则不匹配,因为该规则有一个尾随的
/
。将重写规则的正则表达式(第一部分)更改为:

^/question/([^/]*)/([^/]*)/?$

添加
使尾部的
/
成为可选的。

example.com/index.php/question/9/如何重新连接htaccess
与您的重写规则不匹配,因为该规则具有尾部的
/
。将重写规则的正则表达式(第一部分)更改为:

^/question/([^/]*)/([^/]*)/?$

添加
使尾部的
/
成为可选的。

请发布错误消息,以便我们知道错误所在。键入后转到404页时没有错误消息。请发布错误消息,以便我们知道错误所在。键入后转到404页时没有错误消息。