Link to home
Create AccountLog in
Avatar of sabecs
sabecs

asked on

.htaccess rewrite rules work seperately but not together?

I have a couple of rules in my .htaccess file that work OK on their own but not together?
If I comment one out the other works and vise versa?

Your feedback would be appreciated.


http://www.mywebsite.com.au/241/Services/Services.html

RewriteRule ([0-9]+)(.*)\.html$ index.php?page_id=$1

http://www.mywebsite.com.au/index.php?page_id=241



http://www.mywebsite.com.au/item_details/1147/Web-Design.html

RewriteRule ^([^/]*)/([^/]*)/([^/]*)\.html$ /index.php?page=$1&id=$2&new_page_title=$3 [L]

http://www.mywebsite.com.au/index.php?page=item_details&id=1147&new_page_title=Web-Design

Open in new window

Avatar of Gary
Gary
Flag of Ireland image

You need a RewriteCond for which Rule applies.
Avatar of sabecs
sabecs

ASKER

Thanks GaryC123, but how/where do I add that?
I'm not sure what it is you are trying to do?
You are rewriting seo friendly urls to non friendly?
What condition should be there for the two rewrites?
Avatar of sabecs

ASKER

The URL displayed in browser is

http://www.mywebsite.com.au/241/Services/Services.html

I then rewrite it to get the page_id of 241 and pass it to my PHP page which extract content from my MySQL table based on this page id.

I hope that makes sense?
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of sabecs

ASKER

Thanks Gary, that works perfectly....Cheers..  Andredw