Apache:我的RewriteRules之一不起作用

时间:2019-10-15 16:11:21

标签: apache mod-rewrite

我的所有RewriteRules都运行良好,但以下一项除外:^assets/(.*)$ site/assets/$1 [L]

实际上,我收到404错误,但是我的文件存放在正确的位置...

<script type="text/javascript" src="assets/js/script.js" ></script>

MAMP/website_name/site/assets/js/script.js中的文件

我尝试了不同的方法,但没有解决问题的方法。

RewriteRule ^js/(.*) site/webroot/js/$1 [L]效果很好!

这是我的.htaccess

<IfModule mod_rewrite.c>
  Options +FollowSymLinks -MultiViews
  RewriteEngine On
  RewriteBase /

  RewriteRule ^assets/(.*)$ site/assets/$1 [L]
  RewriteRule fileXupload/server/php/$ fileXupload/server/php/index.php [L]
  RewriteRule site/webroot/uploads$ http://signatix.local [R=301,L]
  RewriteRule site/webroot/uploads/$ http://signatix.local [R=301,L]
  RewriteRule fckeditor/(.*) externallibs/fckeditor/$1 [L]
  RewriteRule ^img/(.*) site/webroot/img/$1 [L]
  RewriteRule ^imgupload/(.*) site/webroot/imgupload/$1 [L]
  RewriteRule ^js/(.*) site/webroot/js/$1 [L]
  RewriteRule ^css/(.*) site/webroot/css/$1 [L]
  RewriteRule ^upload/(.*) site/webroot/upload/$1 [L]
  RewriteRule ^/img/(.*) site/webroot/img/$1 [L]
  RewriteRule /upload/(.*) site/webroot/upload/$1 [L]
  RewriteRule /upload.php site/upload.php [L]
  RewriteRule /md5.php site/md5.php [L]
  RewriteRule ^uploads/(.*) site/webroot/uploads/$1 [L]

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)([[:punct:]]?)(.+)$ index.php?url=$1&%{QUERY_STRING} [L]

  #RewriteCond %{HTTP:HTTPS} !on
  #RewriteRule (.*) http://%{SERVER_NAME}/$1 [QSA,L,R=301]
</IfModule>

我正在尝试使所有RewriteRules正常工作。

0 个答案:

没有答案