从Laravel中的url中删除index.php
我已经使用以下代码从url中删除了index.php,但是如果我键入ww.mywebsite.com/index.php,那么这个url也可以工作,但是如果用户在中键入index.php,我想删除index.php 在url之间。这是我的.htaccess文件的代码从Laravel中的url中删除index.php,php,laravel,.htaccess,Php,Laravel,.htaccess,我已经使用以下代码从url中删除了index.php,但是如果我键入ww.mywebsite.com/index.php,那么这个url也可以工作,但是如果用户在中键入index.php,我想删除index.php 在url之间。这是我的.htaccess文件的代码 <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule&
<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 ^ index.php
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.mywebsite.com/$1 [R,L]
</IfModule>
选项-多视图
重新启动发动机
RewriteCond%{REQUEST_FILENAME}-d[或]
RewriteCond%{REQUEST_FILENAME}-f
重写规则^^$1[N]
重写条件%{REQUEST\u URI}(\.\w+$)[NC]
重写规则^(.*)$public/$1
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-F
重写规则^index.php
重写cond%{SERVER_PORT}80
重写规则^(.*)$https://www.mywebsite.com/$1[R,L]
选项-多视图-索引
选项1
将公用文件夹直接指向主机文件
<Project Path>/public
选项-多视图-索引
选项1
将公用文件夹直接指向主机文件
<Project Path>/public
对于.htaccess,您可以试试这个-
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L] // path to your public directory
</IfModule>
重新启动发动机
重写规则^(.*)$public/$1[L]//到公共目录的路径
或
重新启动发动机
重写cond%{THE_REQUEST}^[A-Z]{3,7}\s/(*)索引\.php\sHTTP*$
重写规则^/%1[R=301,L]
Hop其中一个可以工作。对于.htaccess,您可以试试这个-
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L] // path to your public directory
</IfModule>
重新启动发动机
重写规则^(.*)$public/$1[L]//到公共目录的路径
或
重新启动发动机
重写cond%{THE_REQUEST}^[A-Z]{3,7}\s/(*)索引\.php\sHTTP*$
重写规则^/%1[R=301,L]
Hop其中一个会起作用。请检查此问题已经有人解决了此问题请检查此问题已经有人解决了此问题它正在重定向到mywebsite.com/public,但我必须将其从URL中删除如果可能,主机文件中的更改如
/public
答案已更新请检查,您可以在您的邮箱中设置任何名称受保护文件夹it正在重定向到mywebsite.com/public,但我必须将其从URL中删除。如果主机文件中可能发生更改,如/public
答案已更新,请检查并在受保护文件夹中设置任何名称。是否更改了系统MVC或公用文件夹的路径?是否更改了系统MVC或公用文件夹的路径?
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,7}\s/(.*)index\.php\sHTTP.*$
RewriteRule ^ /%1 [R=301,L]
</IfModule>