Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

.htaccess rewrite rules work seperately but not together?

Posted on 2013-05-14
6
Medium Priority
?
272 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

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 2000 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month7 days, 22 hours left to enroll

610 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