Page 1 of 1

htaccess RewriteRule

Posted: Thu Mar 03, 2011 6:26 am
by Bugs1012
I am learning about the RewriteRule in htaccess.

I have it succesfully working in one domain on my shared server (a test domain, but nevertheless a real address), yet exactly the same file on another domain on the same shared server does not work.

this is the code:

AddType x-mapp-php5 .php
RewriteEngine On
RewriteRule ^Product/([^/]*)\.html$ /Product.php?name=$1 [L]

the only difference is that one is a subdomain.domain.co.uk, and the other is a http://www.domain.co.uk - but i can't see how that would actually change how it works?

Any ideas?

Re: htaccess RewriteRule - CSS strangeness

Posted: Thu Mar 03, 2011 6:52 am
by Bugs1012
Ah. I've figured it out BUT i have another problem.

THE FIX:

There was a file in the directory called Products.php that was somehow confusing the situation.
So i have changed the Rewrite rule to reference a folder called AAA and it works fine (see below)

AddType x-mapp-php5 .php
RewriteEngine On
RewriteRule ^AAA/([^/]*)\.html$ /Product.php?name=$1 [L]


THE NEW PROBLEM:
When the new file is called, it ignores the styles.css file and displays the page like it's 1995 - no formatting, no background etc

The file displays fine when i call it with the ?name= URL.

Re: htaccess RewriteRule

Posted: Thu Mar 03, 2011 7:40 am
by Bugs1012
and finally, i figured it out.

the css was a relative path, as were the graphics, and that was causing the problem.
Hope this thread helps someone else at some point!