admin管理员组文章数量:1325359
I read lots of discussions about this and found no solution. I have a Laravel web app and added a Wordpress site in a subdirectory. This is what my .htaccess
looks like within the public
folder:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond $1 !^(blog)
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
The .htaccess
which resides within public->blog
looks like this:
# BEGIN WordPress
<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>
# END WordPress
Here's the problem:
If I use the plain permalinks, everything works fine. If I use any other type of permalink it adds index.php
to the URL and shows me the Laravel app.
The permalinks adds the index.php
in the permalinks page:
The funny thing is, if I choose the post name
permalink with the %postname%
in it, the URL is:
http://localhost:8000/blog/postname/
and I see the laravel app, but the same URL with the admin (http://localhost:8000/blog/wp-admin/
) or any other admin pages, works fine.
I really don't want to have to use ugly permalinks here.
Is there a solution?
FYI - as you can see on the screenshot, the site is currently on localhost using XAMPP
.
I read lots of discussions about this and found no solution. I have a Laravel web app and added a Wordpress site in a subdirectory. This is what my .htaccess
looks like within the public
folder:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond $1 !^(blog)
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
The .htaccess
which resides within public->blog
looks like this:
# BEGIN WordPress
<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>
# END WordPress
Here's the problem:
If I use the plain permalinks, everything works fine. If I use any other type of permalink it adds index.php
to the URL and shows me the Laravel app.
The permalinks adds the index.php
in the permalinks page:
The funny thing is, if I choose the post name
permalink with the %postname%
in it, the URL is:
http://localhost:8000/blog/postname/
and I see the laravel app, but the same URL with the admin (http://localhost:8000/blog/wp-admin/
) or any other admin pages, works fine.
I really don't want to have to use ugly permalinks here.
Is there a solution?
FYI - as you can see on the screenshot, the site is currently on localhost using XAMPP
.
1 Answer
Reset to default 1I accidentally found a solution. I was using a local XAMPP installation and there was no way around it. Though when I uploaded the site to a live server it worked fine. I hope this helps someone in the future. I've seen a lot of people with the same issue but never saw a solution...
本文标签: urlsWordpress on a subdirectory of LaravelWordpress pretty permalinks inner page shows laravel
版权声明:本文标题:urls - Wordpress on a subdirectory of Laravel - Wordpress pretty permalinks inner page shows laravel 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742155994a2424059.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
index.php
in the URL? – MrWhite Commented Nov 29, 2017 at 17:40.htacess
which resides withinpublic->blog
" - To clarify, you have spelt the.htaccess
(2 c's) filename correctly? (I've since corrected that with my "edit" - but just realised that that would also explain your current problem!) – MrWhite Commented Nov 29, 2017 at 18:51index.php
in the example URL would seem to suggest that it has been unable to detect a suitable rewriting module (ie. mod_rewrite)? "the first option (plain permalinks) is without index.php and works fine" - Incidentally, that wouldn't needindex.php
anyway, even without mod_rewrite (providing theDirectoryIndex
is set correctly). – MrWhite Commented Dec 18, 2017 at 16:35