Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
删除.php扩展名赢得';行不通_Php_Apache_Laravel - Fatal编程技术网

删除.php扩展名赢得';行不通

删除.php扩展名赢得';行不通,php,apache,laravel,Php,Apache,Laravel,我使用的是laravel,使用以下方法删除.php: # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] 但是我使用下面的命令来强制www和ssl,它似乎破坏了上面的代码,并且.php扩展不再被删除,我做错了什么 RewriteCond %{HTTPS} !=on

我使用的是laravel,使用以下方法删除.php:

  # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
但是我使用下面的命令来强制www和ssl,它似乎破坏了上面的代码,并且.php扩展不再被删除,我做错了什么

RewriteCond %{HTTPS} !=on

RewriteCond %{HTTP:X-Forwarded-Proto} !https 

#If neither above conditions are met, redirect to https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

#force www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
完整代码

<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 ^ index.php [L]

 RewriteCond %{HTTPS} !=on

    RewriteCond %{HTTP:X-Forwarded-Proto} !https 

    #If neither above conditions are met, redirect to https
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    #force www
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

选项-多视图
重新启动发动机
#如果不是文件夹,则重定向尾部斜杠。。。
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)/$/$1[L,R=301]
#处理前控制器。。。
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-F
重写规则^index.php[L]
重写cond%{HTTPS}=在…上
重写cond%{HTTP:X-Forwarded-Proto}!https
#如果上述两个条件都不满足,则重定向到https
重写规则^https://%{HTTP_HOST}%{REQUEST_URI}[L,R=301]
#强制www
重写cond%{HTTP_HOST}^www\。
重写规则^(.*)$http://www.%{HTTP_HOST}/$1[R=301,L]

index.php的完整.htaccess“代码”是什么?添加了完整的代码,我也注意到它去掉了.php,但从来没有去掉索引页的.php。好吧,
index.php
是一个文件,所以没有重定向:)我实际上不太处理.htaccess,如果
REQUEST\u文件名
index.php
匹配,
index.php
完整的.htaccess“code”是什么?添加了完整的代码,我还注意到它去掉了.php,但从来没有去掉索引页面的.php。嗯,
index.php
是一个文件,因此,没有重定向:)我实际上没有处理太多.htaccess,但我如何让它改为显示索引。php如果
请求\u文件名
匹配
index.php