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


But only this rule works

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

y? :(
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Add the L option ( 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


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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

when the page views with modrewrited URL,  my other links in the bage starts with ""  how to stop that
Where in your HTML code you have
<a href="pagename.html">Pagename</a>
That you expect to link to, simply put a "/" slash before the url, to make tha path absolute, instead of relative to the current URL
<a href="/pagename.html">Pagename</a>
will always point to
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

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

When I add this rewrite rule FCK editor @ my back-end not working. Whats the prob ?
sahanlakAuthor Commented:
Works perfect, thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.