我在我的共享主机根目录下安装了laravel应用程序"public_html现在我想在ru/子文件夹中安装这个应用的俄文版本,但是当我转到example.com/ru时我得到了404页面找不到错误。我使用apache服务器我根文件夹中的.htaccess文件包含这些代码
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>如何更改此配置?
谢谢。
发布于 2016-12-31 21:51:28
您将按照在根目录中安装它的方式执行此操作。我会告诉你我如何安装在我的共享主机帐户,包括主域和子域。在我将所有项目上传到子文件夹(您将是example.com/ru )之后,请执行以下操作:
.htaccess文件。因为这基本上是一个子域,所以它需要位于该子域的根中,所以将.htaccess从公用文件夹传输到ru文件夹的根。.htaccess并更改/添加以下内容:
DirectoryIndex public/index.php
在RewriteRule中,将其更改为:
public/index.php而且要明确的是,您的.htaccess在您的更改之后应该是这样的:
DirectoryIndex public/index.php
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ public/index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>发布于 2021-12-14 08:16:22
在根文件夹中创建一个.htaccess文件并粘贴代码并保存它。
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]
RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ public/$1
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.phphttps://stackoverflow.com/questions/41407758
复制相似问题