Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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
Html 如何删除url末尾的斜杠?_Html_.htaccess_Url - Fatal编程技术网

Html 如何删除url末尾的斜杠?

Html 如何删除url末尾的斜杠?,html,.htaccess,url,Html,.htaccess,Url,目前,访问我的网站链接的唯一方法是在url的末尾有一个斜杠,如www.me.com/portfolio/如何删除最末尾的斜杠 Options +FollowSymlinks -MultiViews RewriteEngine On RewriteBase / # Remove slashes RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !(.*)$ RewriteRule ^(.*)$ http://domai

目前,访问我的网站链接的唯一方法是在url的末尾有一个斜杠,如www.me.com/portfolio/如何删除最末尾的斜杠

Options +FollowSymlinks -MultiViews

RewriteEngine On
RewriteBase /

# Remove slashes
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)$
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]
我相信这会奏效。把它放在你想要的目录中


我相信这会奏效。把它放在你想做这件事的目录中。

你是在问如何在站点范围内做这件事吗?它实际上只是在一个子目录中。你是在问如何在站点范围内做这件事吗?它实际上只是在一个子目录中。谢谢。这可能是一个愚蠢的问题,但我不认为,我确实用我的实际域名替换了“domain.com”部分,对吗?再次感谢!对我总是忘了自己做这件事,花了15分钟想知道为什么我总是被重定向到domain.com。这可能是一个愚蠢的问题,但我不认为,我确实用我的实际域名替换了“domain.com”部分,对吗?再次感谢!对我总是忘记自己做这件事,花了15分钟想知道为什么我总是被重定向到domain.com XD