URL の末尾にスラッシュがあるかどうかに関係なく機能するようにするには、次の書き換えルールに対して何をする必要がありますか?
すなわち。 http://mydomain.com/content/featured または http://mydomain.com/content/featured/
RewriteRule ^content/featured/ /content/today.html
URL の末尾にスラッシュがあるかどうかに関係なく機能するようにするには、次の書き換えルールに対して何をする必要がありますか?
すなわち。 http://mydomain.com/content/featured または http://mydomain.com/content/featured/
RewriteRule ^content/featured/ /content/today.html
を使用し$
て文字列の末尾を?
マークし、前の式を 0 回または 1 回繰り返すようにマークします。
RewriteRule ^content/featured/?$ content/today.html
ただし、1 つの表記法に固執し、スペルミスを修正することをお勧めします。
# remove trailing slashes
RewriteRule (.*)/$ $1 [L,R=301]
# add trailing slashes
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .*[^/]$ $0/ [L,R=301]