2

Here is my .htaccess file in public_html :

# Do not remove this line, otherwise mod_rewrite rules will stop working
RewriteBase /

DirectoryIndex /index.html

Redirect /index.html http://mysite.com/home.html

RewriteEngine On
RewriteCond %{REQUEST_URI} !\.(?:jpeg|jpg|ico|svg|eot|woff|ttf|gif|bmp|png|tiff|css|js)$ [NC]
RewriteRule !^page/ page%{REQUEST_URI} [L,NC]

As you can see I set the website to load .html files from /page/. Unfortunately this method seems to be getting me in some trouble. First of all the favicon won't load (yes it is in the right place with proper href). I even added |ico| to that line of code in .htaccess. Any ideas on why jpgs etc. have no problem loading but the .ico fails?

Second, my site uses @fontface and i'm a little worried that .svg .eot .woff and .ttf font files might also fail due to the .htaccess trickery. I added those file extensions to the line of code in .htaccess but have no way of testing on various computers that might need the different font formats.

4

1 に答える 1

2

ページのルールのみを実行するように条件を変更してみてください

RewriteEngine On
RewriteCond %{REQUEST_URI} \.(php|html?)$ [NC]
RewriteRule !^page/ page%{REQUEST_URI} [L,NC]

これは、ルールで誤ってリダイレクトされる可能性のあるさまざまなファイルの種類すべてについて心配する必要がないため、より簡単です。既存のルールに違反しているものに答えるには、サイトのディレクトリ構造とファイルの場所を共有する必要があります。

于 2013-10-19T04:14:58.457 に答える