【发布时间】:2021-07-26 06:08:38
【问题描述】:
我阅读了很多关于此的讨论,但没有找到解决方案。我有一个 Laravel 网络应用程序,并在子目录 public 中添加了一个 Wordpress 博客 (Blog)。这是我的 .htaccess 在公用文件夹中的样子:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
这是我在 wordpress 根目录中的 .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /Blog/
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /Blog/index.php [L]
</IfModule>
如果我使用普通的永久链接,一切正常。如果我使用任何其他类型的永久链接,它会将 index.php 添加到 URL 并显示 Laravel 应用程序。永久链接在永久链接页面中添加 index.php:
look here, currently all this is well but if i use any type of permalinks no(plain) it's not work
有趣的是,如果我选择带有 %postname% 的帖子名称永久链接,则 URL 为:
http://localhost:8000/blog/postname/
我看到 laravel 应用程序,但与管理员的 URL 相同
(http://localhost:8000/blog/wp-admin/) 或任何其他管理页面都可以正常工作。
我真的不想在这里使用丑陋的永久链接。
有解决办法吗?
NB - 正如您在 url 上看到的,该站点当前位于本地主机上,在 kali linux 中使用 APACHE
【问题讨论】:
标签: wordpress laravel .htaccess url permalinks