2016-09-06 8 views
-3

私は1つのウェブサイトを開発しており、URLをより多くのユーザーと使いやすいようにするために、自分のウェブサイトs7infoからエクステンションを削除したいと考えています。私はPHPページから.php拡張子を削除する方法に関するチュートリアルを見つけました。 .htmlはどうですか?私もそれらを削除したい..!.htacessを使って.php、.html、.htm拡張子を削除するには?

+2

は、このリンクを通過http://stackoverflow.com/questions/4026021/remove-php-extension-with-htaccess – rahul

+0

、これを試してみてくださいhttps://alexcican.com/post/how-to-remove-php-html-htm-extensions-with-htaccess/ – aavrug

+0

紹介リンクをありがとう...! –

答えて

1

これを読んで

.htacessファイル

<IfModule mod_rewrite.c> 
RewriteEngine on 

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}.php -f 
RewriteRule ^(.*)$ $1.php 
#RewriteRule ^([a-z]+)\/?$ $1.php [NC] 


RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}.html -f 
RewriteRule ^(.*)$ $1.html 
#RewriteRule ^([a-z]+)\/?$ $1.html [NC] 

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}.htm -f 
RewriteRule ^(.*)$ $1.htm 
#RewriteRule ^([a-z]+)\/?$ $1.htm [NC] 

</IfModule> 
+0

すばやく再生してくれてありがとうDave –

関連する問題