我要做一个网站一个网站结构,清理... http://dev.514hebergement.com/
寻找htaccess的指令重写所有网页的URL更友好的URL结构不动,在文件夹层次的实际页面。
所以每一个页面是/pages/pagename.cfm内
将改写其地址/网页/
和响应都/网页/和/pages/pagename.cfm网址。
让记住我需要的页面名称是动态的,在htaccess的指令没有硬编码。
非常感谢!
我目前的htaccess坐落在网站的根目录:
Options +FollowSymLinks
RewriteEngine on
# DROP THE INDEX FILENAME #
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)index\.cfm($|\ |\?)
RewriteRule ^ /%1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)INDEX\.CFM($|\ |\?)
RewriteRule ^ /%1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)INDEX\.cfm($|\ |\?)
RewriteRule ^ /%1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)index\.CFM($|\ |\?)
RewriteRule ^ /%1 [R=301,L]
# v3 PAGES #
RedirectPermanent /Hebergement-Internet-Montreal/ /
RedirectPermanent /Hebergement-Web-Montreal/ /
RedirectPermanent /Hebergement-Web-Montreal/commander-hebergement.cfm /commander.cfm
RedirectPermanent /hebergement-php.cfm /forfaits-linux.cfm
RedirectPermanent /Hebergement-Web-Montreal/faq.cfm /faq.cfm
RedirectPermanent /Hebergement-Web-Montreal/termes.cfm /termes.cfm
RedirectPermanent /Hebergement-Internet-Montreal/contact.cfm /contact.cfm
# SOLUTIONS-TECHNOLOGIES #
RedirectPermanent /hebergement-linux.cfm /hebergement-web-linux.cfm
RedirectPermanent /hebergement-coldfusion.cfm /hebergement-web-coldfusion.cfm
RedirectPermanent /hebergement-windows.cfm /hebergement-web-windows.cfm
RedirectPermanent /hebergement-mysql.cfm /hebergement-web-mysql.cfm
RedirectPermanent /hebergement-perl.cfm /hebergement-web-perl.cfm
RedirectPermanent /hebergement-php.cfm /hebergement-web-php.cfm
# ARCHIVED PAGES #
RedirectPermanent /Hebergement-Internet-Montreal/promotions.cfm /
RedirectPermanent /promotions.cfm /
RedirectPermanent /hebergement-asp.cfm /forfaits-windows.cfm
输入在地址栏的确切地址IM是: http://dev.514hebergement.com/pages/hebergement-web-montreal-qualite.cfm
结果网址rewrited至:/页/ hebergement-Web的蒙特利尔QUALITE
我想这样的:/ hebergement-Web的蒙特利尔QUALITE /
行该工程...加入结尾的斜线到rewrited URL - >重写规则^ /%1 / [R = 302,L,NE]
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} \s/+pages/(.+?)\.cfm[\s?] [NC]
RewriteRule ^ /%1/ [R=302,L,NE]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/pages/$1\.cfm -f [NC]
RewriteRule ^(.+?)/?$ pages/$1.cfm [L]
所以最后一步将是重定向页面根向/pages/pagename.cfm文件...
这可以是动态的,否则我将不得不单独列出所有网页?