htaccess RewriteRule

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Bugs1012
Forum Newbie
Posts: 5
Joined: Fri Jun 26, 2009 6:21 am

htaccess RewriteRule

Post 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?
Bugs1012
Forum Newbie
Posts: 5
Joined: Fri Jun 26, 2009 6:21 am

Re: htaccess RewriteRule - CSS strangeness

Post 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.
Bugs1012
Forum Newbie
Posts: 5
Joined: Fri Jun 26, 2009 6:21 am

Re: htaccess RewriteRule

Post 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!
Post Reply