簡體   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