你可以使用類似這樣
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(?:[^/]*/)*([^/.]+\.(?:jpe?g|gif|bmp|png|tiff|css|js|images))$ /new-site/$1 [R=301,L,NC]
編輯:
這裏有更多的代碼一點點的解釋,所以你可以看到這裏的一切是你的服務器上。
RewriteEngine On
RewriteCond %{THE_REQUEST} "index.php"
RewriteRule ^index.php$ public/ [R=301,L]
RewriteRule . public/index.php [QSA,L]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(?:[^/]*/)*([^/.]+\.(?:jpe?g|gif|bmp|png|tiff|css|js))$ /public/assets/$1 [R=301,L,NC]
所以剛開始它說,搜索的index.php(在你的情況可能是index.html或別的什麼地方該網站開始於第一),之後,它說重定向到文件夾公共/對服務器,因爲idex.php位於/ www/public或/ public_html/public,在你的情況下,它可能是/ www/new-site /所以你會做新站點/在該部分的代碼,下一步添加相同的。所以新網站/ index.php或任何它在你的情況。在最後一部分,它說在/ public/assets /中搜索以jpg/jpeg,gif,bmp,png,tiff,css或js結尾的文件,在您的情況下,它可能是新站點/資產/或者只是新的-現場/。
希望澄清一下。
可能的複製https://stackoverflow.com/questions/27173191/css-disapears-when-trying-to-create-乾淨的網址) – Croises