Ginko
Ginko

Reputation: 395

Can't access css file, htaccess

I've added a .htaccess file to redirect some of the requests, for example: /home/index becomes /index.php?controller=home&action=index&params=, but that .htaccess file prevents me to access /content/styles.css file too. For some reason I can access /content/images/default.png.

Htaccess contents:

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]

And it's located in public_html directory.

I've tried to add another .htaccess with Options +Indexes to /content/ directory, but no change. Accessing any file from /content/ but no /content/images/ is prevented.

This: <link rel="stylesheet" href="/content/styles.css" /> - doesn't work. This: mysite.com/content/styles.css - doesn't work. This: mysite.com/content/images/default.png - works.

//Edit:

When I move /content/styles.css to /content/styles/styles.css is works well, but is there something wrong with this config?

Upvotes: 0

Views: 533

Answers (1)

Abhishek Gurjar
Abhishek Gurjar

Reputation: 7476

Add this tag in pages where you want to access css and png files.

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

And then try to access that page.

Upvotes: 1

Related Questions