1

私はウェブサイトを開発していて、きれいなURLを取得する必要があります。

たくさんのチュートリアルを読んで数時間過ごした後、それはいつも私にエラーを返します。

ルートディレクトリ(www.mysite.com/.htaccess)に.htaccessファイルを作成します。

私は、URLがwww.mysite.com/subdirectory/news.phpからwww.mysite.com/subdirectory/news/になります。

で試してみました

RewriteRule ^ subdirecotry / news.php $ www.mysite.com/subdirectory/news [L]

しかし、それは機能しませんでした。ありがとうございました!

4

1 に答える 1

1

あなたが試すことができます:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(subdirecotry/news)\.php/?\s [NC]
RewriteRule ^ /%1 [R,L]

RewriteRule ^(subdirecotry/news)/?$ /$1.php [L,NC]
于 2012-05-11T18:03:24.813 に答える