2010-11-06 4 views
0

Je ces urls dans mon blogComment puis-je supprimer index.html index.php avec htaccess

http://myblog.com/news/post1/index.php 
http://myblog.com/updates/post3/index.html 
http://myblog.com/index.html 
http://myblog.com/blog/post4/index.php 

Comment puis-je .htaccess de configuration afin que tous les urls finiront par "/"

http://myblog.com/news/post1/ 
http://myblog.com/updates/post3/ 
http://myblog.com/ 
http://myblog.com/blog/post4/ 

Merci d'avance!

Répondre

1

Pour supprimer l'extension .php à partir d'un fichier PHP:

Options +FollowSymLinks 
Options +Indexes 
RewriteEngine on 
RewriteCond %{SCRIPT_FILENAME} !-d 
RewriteRule ^([^\.]+)$ $1.php [NC,L] 

Si vous souhaitez supprimer l'extension .html à partir d'un fichier html:

RewriteRule ^([^\.]+)$ $1.html [NC,L] 

Ou voir ce post:

+0

merci je vais l'essayer! – Maca

+5

Ceci traduit '/ example/file.php' en'/example/file'. La question était de savoir comment rediriger '/ example/index.php' ou'/example/index.html' vers '/ example /'. –

Questions connexes