繁体   English   中英

在wordpress上使用virtualhost在URL中添加index.php

[英]index.php added in url with virtualhost on wordpress

我用MAMP创建了一个虚拟主机。 当我转到example.dev时,它运行良好。 我只是在example.dev上安装了一个wordpress,没有任何问题。 当我显示页面或帖子时,在页面名称之前会添加一个/index.php。 例如:example.dev/ index.php / pagename。 我无法访问example.dev/pagename,但出现404错误。 在永久链接的选项中,它会自动生成/index.php/%year%/%monthnum%/%day%/%postname%/ 我选择了http://example.dev/example-article/但仍然无法正常工作。

我的根有htaccess

RewriteEngine On

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

# END WordPress

如果有人有主意...

谢谢 !!

到此url /index.php/%year%/%monthnum%/%day%/%postname%/可以在Apache服务器上运行将此规则添加到.htaccess文件中

RewriteRule ^index.php/(.*)/?$ /$1/ [L] 

以上WordPress规则:

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

鉴于您的.htaccess具有基本的WordPress规则,因此如下所示:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php/(.*)/?$ /$1/ [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

结束WordPress

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM