views:

136

answers:

2

I have a directory /public_html/myfolder/ and I want my domain www.example.com to point to /public_html/myfolder/ as my root folder.

I figured that out, but problem is, my images are not showing.

Here's my .htaccess file:

Options -Indexes
RewriteEngine on
Options +FollowSymLinks

RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule .* https://www.example.com/$1   [L,R=301]
RewriteRule ^$ myfolder/index.php   [L]

# Require SSL
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST} [L]

# Rewrite rules
<IfModule mod_rewrite.c>
  #RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ myfolder/index.php?q=$1 [L,QSA]
</IfModule>
A: 

You will need to make sure the images are ignored by using RewriteCond's. Try something like

RewriteCond %{REQUEST_FILENAME} !\.(jpg|png|gif)$

(not sure if the . should be escaped, but i think it should be)

You can also try adding RewriteLog RewriteLogLevel 3 (or maybe greater) I'm not sure if this works if it is inserted into a .htaccess, it might be that it has to be in the server conf, but it is worth a try. It is easier to debug rewrite if you have the log.

Torandi
A: 

The issue may be that you have relative paths specified for your images on pages and after the URL is rewritten the links get broken. To fix this cosider using root-relative paths for the resources.

TonyCool