.htaccess在重定向之前删除尾部斜杠

时间:2018-05-15 08:35:40

标签: .htaccess redirect

当我重定向到另一个页面时,我无法删除尾部斜杠。

请参阅我的代码:

Redirect /contact  example.com/page

当我运行上面的代码时,它会将我重定向到带有斜杠的example.com/page/。

我想知道如何从网址中删除尾部斜杠。

完整.htaccess:

# All explanations you could find in .htaccess.sample file

Redirect /configurator.html /box.html
Redirect /catalog/category/view/s/blog/id/9 http://www.example.nl/blog

Redirect /contact/index/ http://www.example.com/contact.html
Redirect /contact.html/post http://www.example.com/contact.html

DirectoryIndex index.php
   <IfModule mod_php5.c>
   php_value memory_limit 768M
   php_value max_execution_time 18000
   php_flag session.auto_start off
   php_flag suhosin.session.cryptua off
</IfModule>
<IfModule mod_php7.c>
    php_value memory_limit 768M
    php_value max_execution_time 18000
    php_flag session.auto_start off
    php_flag suhosin.session.cryptua off
</IfModule>
<IfModule mod_security.c>
   SecFilterEngine Off
   SecFilterScanPOST Off
</IfModule>
<IfModule mod_ssl.c>
   SSLOptions StdEnvVars
</IfModule>
<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
    RewriteRule .* - [L,R=405]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule .* index.php [L]

0 个答案:

没有答案