.htaccess 重定向到目录
这是一个非常愚蠢的问题,但我在 htaccess 方面很弱。
我想要位于 http://localhost/template/* 的所有文件(php、css、javascript 和图像)指向 http://localhost/* 以及位于 http://localhost/tempalte/404.php
我几乎在这里得到它,但当我更改时,
RewriteRule ^(.*)\.(css|php|js|png|gif) template/$1 [NC,L] to
RewriteRule ^(.*)\.(css|php|js|png|gif) template/$1.$2 [NC,L]
我收到内部服务器错误。
# BEGIN website
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)\.(css|php|js|png|gif) template/$1 [NC,L]
</IfModule>
Options -Indexes
# END website
This is a very silly question but I am pretty weak in htaccess.
I want all files (php, css, javascripts and images) located at http://localhost/template/* to point to http://localhost/* along with a 404 Error Handler that is located at http://localhost/tempalte/404.php
I almost got it here but when I change
RewriteRule ^(.*)\.(css|php|js|png|gif) template/$1 [NC,L] to
RewriteRule ^(.*)\.(css|php|js|png|gif) template/$1.$2 [NC,L]
I get an internal server error.
# BEGIN website
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)\.(css|php|js|png|gif) template/$1 [NC,L]
</IfModule>
Options -Indexes
# END website
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编辑以反映评论,试试这个:
Edited to reflect comments, try this: