您好,我面临从网址中删除 public/index.php 的问题。从 url 中删除/重定向 index.php 以防止重复的 url 此链接确实帮助我删除了 index.php 表单 url,但我无法从 url 中删除 public/index.php。这是我的下面的 htacces 代码
RewriteEngine On
#REmove index.php from url starts
RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*?)index\.php[^/] /$1? [L,R=302,NC,NE]
RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*?)index\.php(?:/(.*))?$ /$1$2? [L,R=302,NC,NE]
#Remove index.php from url ends
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)
但是当我添加下面的代码来删除 htaccess 中的 public/index.php 时,它不起作用:-
RewriteCond …Run Code Online (Sandbox Code Playgroud)