2017-07-08 69 views
0

現在我有這個和重寫的index.php指數如何使用mod_rewrite更改.htaccess中的更多擴展名?

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^([^\.])$ $1.php [NC,L] 

但我想也該文件名about.html更改至無的.html 我該怎麼做呢?

+0

不可能的。你不會知道,如果它是'.php'或'.html' – colburton

+0

exemple.com/index.php變化exemple.com/index 但我怎麼也改變 exemple.com/about.html到爲例。 com/about – YouSeeStefan

+0

只需刪除'.html'?這與'.htaccess'無關。 – colburton

回答

1

看到這個

對於REMOVE .PHP

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php 

對於REMOVE .HTML

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.html -f 
RewriteRule ^(.*)$ $1.html 
+0

非常感謝! – YouSeeStefan