2009-05-21 14 views
1

私はいくつかのhtmlファイルを持つサイトを持っています。それらの1つはcontact.htmlです。これは私の.htaccessです。site.com/contact/ではなく、site.com/contactを使ってページに対処することができます。 (終了スラッシュに注意してください。)修正は何ですか?スラッシュを.htaccessで追加できません

RewriteEngine On 

# If the requested URI does not contain a period in the final path-part 
RewriteCond %{REQUEST_URI} !(\.[^./]+)$ 
# and if it does not exist as a directory 
RewriteCond %{REQUEST_fileNAME} !-d 
# and if it does not exist as a file 
RewriteCond %{REQUEST_fileNAME} !-f 
# then add .html to get the actual filename 
rewriterule (.*) /$1.html [L] 

答えて

1

の代わりに:

rewriterule (.*) /$1.html [L] 

試してみてください。私の場合は

RewriteRule ^([^/]*)/?$ /$1.html [L] 
+0

それを修正しました。 src、href、およびimageリンクを使ってすべての相対パスを探し、固定パスに切り替えるだけでした。 –

0
RewriteRule ^([^/]*)/?$ $1.php [L] 

、私は$ 1の前にスラッシュを削除し、それが動作します!私はあなたのコメントから多くを学ぶことに感謝します。

関連する問題