我刚把laravel安装到/admin/recurring目录下但是后来我发现所有的商品都在公共场所我如何指向所有进入/admin/recurring/foo/bar/123的流量实际调用请求到/admin/recurring/public/foo/bar/123
这是我尝试的:
<IfModule mod_rewrite.c>
RewriteEngine On
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#This last condition enables access to the images and css folders, and the robots.txt file
RewriteCond $1 !^(index'.php|public|images|robots'.txt|css)
RewriteRule ^(.*)$ public/index.php/$1 [L]
</IfModule>
但这不起作用。它给了我一个对不起,您正在寻找的页面无法找到。
不需要mod_rewrite。你应该这样做:
<Directory /path/to/admin/recurring>
FallbackResource /admin/recurring/public/index.php
</Directory>
(注意:这假设您至少运行2.2.16或更高版本。你应该是这样的。2.4版本已经发布近5年了
同样,如果这是在。htaccess文件中,你只需要FallbackResource
行,在/path/to/admin/recurring/.htaccess
你会尝试这个并检查它是否有效吗?在目录标签中添加/admin/recurring
的全路径
<Directory "/admin/recurring">
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ public/index.php/$1 [L]
</IfModule>
</Directory>