如何从localhost XAMPP中删除带有.htaccess的斜杠网址

时间:2017-12-07 10:02:41

标签: php .htaccess slash

例如:

<a href="/example/">example</a>

<a href="example">example</a>

<link type="text/css" href="/assets/css/bootstrap.min.css" />

<link type="text/css" href="assets/css/bootstrap.min.css" /> enter image description here

我的htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]

请帮忙!....

1 个答案:

答案 0 :(得分:0)

这个怎么样?

RewriteEngine On

RewriteRule ^ /(。*)$ / $ 1 [R = 301,L]

RewriteRule ^ /(。*)$ / $ 1 / [R = 301,L]