Only one rule works in Mod_Rewrite

Hello this is my htaccess

<IfModule mod_rewrite.c>
RewriteEngine on


RewriteRule webbdesign/(.*)/(.*)/(.*)/(.*)\.html /pages.php?sid=$1&mpg=$2&mn=$3&sn=$4
RewriteRule (.*)/(.*)\.html /pages.php?mid=$1&mn=$2


RewriteRule webbdesign /index.php

</IfModule>

But only this rule works

RewriteRule (.*)/(.*)\.html /pages.php?mid=$1&mn=$2


y? :(
sahanlakAsked:
Who is Participating?
 
hernst42Connect With a Mentor Commented:
Add the L option (http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html) and try this:
RewriteEngine on
RewriteRule webbdesign/(.*)/(.*)/(.*)/(.*)\.html /pages.php?sid=$1&mpg=$2&mn=$3&sn=$4 [L]
RewriteRule (.*)/(.*)\.html /pages.php?mid=$1&mn=$2 [L]
RewriteRule webbdesign /index.php [L]

Open in new window

0
 
sahanlakAuthor Commented:
It works, thanks a lot. Have few questions. I believe that [L] is limiting ? how does that help?

And other one I'm using relative links so this is the prob.

Before mod rewrite this was my page

www.mydomain.com/page.php?mid=8

when the page views with modrewrited URL,

www.mydomain.com/8/pagename.html  my other links in the bage starts with "www.mydomain.com/8/"  how to stop that
0
 
ciprian-dobreaCommented:
Where in your HTML code you have
<a href="pagename.html">Pagename</a>
That you expect to link to www.mydomain.com/pagename.html, simply put a "/" slash before the url, to make tha path absolute, instead of relative to the current URL
so:
<a href="/pagename.html">Pagename</a>
will always point to www.mydomain.com/pagename.html
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
hernst42Commented:
nope [L] is last, stop rewriting here and do no further rewriting.
0
 
sahanlakAuthor Commented:
Hello,

When I add this rewrite rule FCK editor @ my back-end not working. Whats the prob ?
0
 
sahanlakAuthor Commented:
Works perfect, thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.