2017-01-08 14 views
0

いくつかのリクエストをリダイレクトするための.htaccessファイルを追加しました。たとえば、 /home/index/index.php?controller=home&action=index&params=になりますが、.htaccessファイルは/content/styles.cssファイルにアクセスできませんあまりにも。何らかの理由で私は/content/images/default.pngにアクセスできます。cssファイルのhtaccessにアクセスできない

htaccessの内容:

Options +Indexes 
Options -MultiViews 
RewriteEngine On 

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 

RewriteRule ^(.[^\/]+)\/(.[^\/]+)\/(.+)\/*$ index.php?controller=$1&action=$2&params=$3 [QSA,L] 
RewriteRule ^(.[^\/]+)\/*$ index.php?controller=$1 [QSA,L] 
RewriteRule ^(.[^\/]+)\/(.[^\/]+)\/*$ index.php?controller=$1&action=$2 [QSA,L] 

そしてそれはpublic_htmlディレクトリにあります。

Options +Indexes/content/ディレクトリの別の.htaccessを追加しようとしましたが、変更はありません。 /content/から任意のファイルにアクセスしますが、/content/images/はアクセスできません。

これは<link rel="stylesheet" href="/content/styles.css" /> - 動作しません。 これはmysite.com/content/styles.css - 動作しません。 これはmysite.com/content/images/default.pngです。

//編集:

私は/content/styles/styles.css/content/styles.cssを移動うまく機能しているが、この設定に何か問題はありますか?

答えて

1

csspngファイルにアクセスするページにこのタグを追加します。

<base href="http://www.yourdomain.com/" /> 

そして、そのページにアクセスしてみてください。

+0

私はうまくいきませんでしたが、私はpublic_htmlの 'index.php'と' layout.php 'の両方にその行を入れました。これにはすべてのページのhtmlが含まれています。それは私が見つけられなかったが、他のファイル(サイトが会社によって運営されている)のなかの奇妙な.htaccess設定かもしれない。 – Ginko

関連する問題