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?

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

x
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.

hernst42Commented:
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

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

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

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

From novice to tech pro — start learning today.