Solved

.htaccess rewrite rules work seperately but not together?

Posted on 2013-05-14
6
265 Views
Last Modified: 2013-05-14
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

0
Comment
Question by:sabecs
  • 3
  • 3
6 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 39165431
You need a RewriteCond for which Rule applies.
0
 

Author Comment

by:sabecs
ID: 39165455
Thanks GaryC123, but how/where do I add that?
0
 
LVL 58

Expert Comment

by:Gary
ID: 39165487
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?
0
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 

Author Comment

by:sabecs
ID: 39165514
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?
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39165593
I'm guessing item_detail is the deciding factor

RewriteCond %{REQUEST_URI} item_details
RewriteRule ^([^/]*)/([^/]*)/([^/]*)\.html$ /index.php?page=$1&id=$2&new_page_title=$3 [L]
RewriteRule ([0-9]+)(.*)\.html$ index.php?page_id=$1

Open in new window

0
 

Author Closing Comment

by:sabecs
ID: 39165748
Thanks Gary, that works perfectly....Cheers..  Andredw
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now