Laravel项目中的.htaccess文件

pubilc/.htaccess

Apache

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>
 
    RewriteEngine On
 
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
 
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]
 
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Nginx

rewrite ^(.*?)/article/.*?-(d+)-(d+).html$  $1/show.html?id=$2&page=$3   break;
rewrite ^(.*?)/category/.*?-(d+)-(d+).html$ $1/list.html?id=$2&page=$3   break;
rewrite ^(.*?)/tag/([^/]+)/?$  $1/tag.html?w=$2    break;
rewrite ^(.*?)/tag/([^/]+)/(d+)$    $1/tag.html?w=$2&page=$3    break;
posted @ 2023-01-01 12:38  摇摆啊~  阅读(286)  评论(0)    收藏  举报