Forum Moderators: phranque

Message Too Old, No Replies

problems with subdomain using htaccess

won't show files

         

PixelchickDK

11:00 pm on Dec 28, 2003 (gmt 0)



I need some help here..

I've made a subdomain using htaccess, and made a directory called "photo", where all the files for the subdomain are to be placed in.. But when I enter the domain and get a list over the files in the "photo" directory, they don't work when I press their links.. Have a look at [photo.example.dk...]

The code I used is this:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^photo\.example\.dk [NC]
RewriteRule ^/?$ /photo/$1 [L]

Why does it show the index right, but not open the files?

[edited by: jdMorgan at 10:36 am (utc) on Dec. 29, 2003]
[edit reason] No specific URLs please [/edit]

jdMorgan

10:35 am on Dec 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



PixelchickDK,

Welcome to WebmasterWorld [webmasterworld.com]! (Please read)

It looks like your RewriteRule will only redirect if the requested URI (file) is either "/" or blank. Also, you have back-referenced local variable $1, but it is not defined. Back-references are defined by sub-patterns enclosed in parentheses. Try this:


RewriteRule (.*) /photo/$1 [L]

You may also need to add an exclusion in order to prevent an "infinite loop":

RewriteEngine on
RewriteCond %{HTTP_HOST} ^photo\.example\.dk [NC]
RewriteCond %{REQUEST_URI} !^/photo
RewriteRule (.*) /photo/$1 [L]

Jim