htaccess文件将虚拟目录地址添加到网址
问题描述:
我编写了一个脚本来为所有没有它的请求添加shtml扩展。这是它:htaccess文件将虚拟目录地址添加到网址
Options +FollowSymlinks
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} htmlTemplates
RewriteCond %{REQUEST_FILENAME} !\.shtml$
RewriteRule ^.*/(.*)$ $1.shtml [r,nc]
</IfModule>
我尝试了我的本地服务器,它是一个虚拟的位置上,它结束了与文件系统位置,而这样的重写URL:
http://svn1/C:/Documents和设置/ vunsal/My Documents/My Dropbox/Workspace/National Grid/Templating/Svn1/site/index.shtml
任何人都可以告诉我我的配置有什么问题吗?
答
试试这个:
RewriteCond $0 htmlTemplates
RewriteCond $0 !\.shtml$
RewriteRule .* %{REQUEST_URI}.shtml [R=301,L]