【发布时间】:2017-01-01 07:45:12
【问题描述】:
当我在浏览器地址栏中以 https://myurl.com/path 的形式输入 URL 时,我希望重写为 https://myurl.com/path/
在.htaccess中,我的重写规则如下:
#RewriteEngine On
#RewriteCond %{HTTP_HOST} !^myurl.com$
#RewriteRule ^(.*)$ http://myurl.com/$1 [R=301,L]
#RewriteCond %{SERVER_PORT} 80
#RewriteRule ^(.*)$ https://myurl.com/$1 [R,L]
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule .* https://myurl.com%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule !.*\.html$ %{REQUEST_FILENAME}.html [L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
【问题讨论】:
标签: wordpress .htaccess url-rewriting