htaccess和斜杠

时间:2018-08-23 11:17:25

标签: .htaccess

我需要使用htaccess重写多个网址:

tuto.php -> https://example.com/tuto/

tuto.php?c=book -> https://example.com/tuto/book

tuto.php?c=book&s0=sub0&s1=sub1 -> https://example.com/tuto/book/sub0-to-sub1

谢谢。

1 个答案:

答案 0 :(得分:0)

我正在尝试帮助您https://example.com/tuto/book/sub0-to-sub1休息,您可以尝试一下或通过谷歌搜索找到它们并不困难。

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)$ $1.php [L]
RewriteRule ^([^/]+)/([^/]+)$ $1.php?c=$2 [L]
RewriteRule ^([^/]+)/([^/]+)/(.+)\-to\-(.+)$ $1.php?c=$2&s0=$3&s1=$4 [L]