Wordpress 从URL中删除文件夹名称

Wordpress 从URL中删除文件夹名称,wordpress,windows,laravel,.htaccess,xampp,Wordpress,Windows,Laravel,.htaccess,Xampp,我有WP和Laravel6的结构 my_site/ .htaccess wp/ laravel/.htaccess 和虚拟主机 <VirtualHost subdomain.local:777> DocumentRoot "c:\xampp\htdocs\my_site" ServerName subdomain.local </VirtualHost> 现在subdomain.local:777显示wp登录页 接下来,我想从l

我有WP和Laravel6的结构

my_site/
    .htaccess
    wp/
    laravel/.htaccess
和虚拟主机

<VirtualHost subdomain.local:777>
    DocumentRoot "c:\xampp\htdocs\my_site"
    ServerName subdomain.local
</VirtualHost>
现在subdomain.local:777显示wp登录页

接下来,我想从laravel ie提供的URL中删除laravel文件夹:

subdomain.local:777/laravel/login to subdomain.local:777/login
subdomain.local:777/laravel/profile to subdomain.local:777/profile
等等

为此,我在laravel/.htaccess中添加了以下内容,但它会使所有路由崩溃

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^laravel/(.*)$ /$1 [L,NC,R]
错误地

Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

Error 404
subdomain.local
Apache/2.4.37 (Win32) OpenSSL/1.1.1 PHP/7.2.12
此外,我的laravel/.htaccess文件还将css/js/image/font配置为这样工作

Options -MultiViews -Indexes
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]

# Handle Front Controller...
RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt|\.woff|\.woff2|\.ttf)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(css|js|images|google_map|image_compressor|admin-files|fontawesome-free|webfonts)/(.*)$ public/$1/$2 [L,NC]

或者我需要在c:\xampp\apache\conf\httpd.conf中进行编辑,最后通过root.htaccess中的位更改来解决。因此.htaccess的最终版本现在是

RewriteEngine on
# remove wp from urls
RewriteCond %{HTTP_HOST} ^subdomain.local:777$
RewriteCond %{REQUEST_URI} !^/wp/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /wp/$1
RewriteCond %{HTTP_HOST} ^subdomain.local:777$
RewriteRule ^(/)?$ wp/index.php [L]

# Rewrite Laravel Routes
RewriteCond %{REQUEST_URI} !^/login [OR]
RewriteCond %{REQUEST_URI} !^/profile
RewriteRule ^(.*)$ laravel/public/$1 [L]

最后通过root.htaccess中的位更改解决了这个问题。因此.htaccess的最终版本现在是

RewriteEngine on
# remove wp from urls
RewriteCond %{HTTP_HOST} ^subdomain.local:777$
RewriteCond %{REQUEST_URI} !^/wp/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /wp/$1
RewriteCond %{HTTP_HOST} ^subdomain.local:777$
RewriteRule ^(/)?$ wp/index.php [L]

# Rewrite Laravel Routes
RewriteCond %{REQUEST_URI} !^/login [OR]
RewriteCond %{REQUEST_URI} !^/profile
RewriteRule ^(.*)$ laravel/public/$1 [L]