【问题标题】:Htaccess mod rewrite questionHtaccess mod重写问题
【发布时间】:2011-03-13 12:28:00
【问题描述】:

我用这段代码重写

example.com/sample-file.php 到 example.com/sample-file

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

我怎样才能重定向这个:

example.com/sample-file 到 example.com/sample-file/

【问题讨论】:

    标签: .htaccess


    【解决方案1】:

    在你的参数参数中添加斜线,所以它看起来像:

    RewriteRule ^(.*)/$ $1.php
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-03-03
      • 1970-01-01
      • 1970-01-01
      • 2011-02-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多