0

I have 2 pages for members profile pages and companies profile pages, for the members the url should be: site.com/users/USER_ID for the companies the url should be: site.com/COMPANY_ID

I have this in my .htaccess:

#Members Profile Page
RewriteRule ^users/(.*)$ modules/members/members_profile.php?id=$1
RewriteRule ^users/(.*)/$ modules/members/members_profile.php?id=$1

#Companies Profile Page
RewriteRule ^(.*)$ modules/companies/companies_profile.php?id=$1
RewriteRule ^(.*)/$ modules/companies/companies_profile.php?id=$1

But, these 2 rules have conflict which cause the users page also be leaded to companies_profile.php since the rule for companies also contain the users profile page in the address.

UPDATE: I've also used [L] flag, not working...:

#Members Profile Page
RewriteRule ^users/(.*)$ modules/members/members_profile.php?id=$1 [L]
RewriteRule ^users/(.*)/$ modules/members/members_profile.php?id=$1 [L]

#Companies Profile Page
RewriteRule ^(.*)$ modules/companies/companies_profile.php?id=$1
RewriteRule ^(.*)/$ modules/companies/companies_profile.php?id=$1

Still, it is loading companies_profile.php for URLs like /users/etc..

How I could solve this?

Thanks for any help

1 Answer 1

1

This here works (/ at the begining) - according to the URL you posted, this will do what you want.

#Members Profile Page
RewriteRule ^/users/(.*)$ modules/members/members_profile.php?id=$1 [L]
RewriteRule ^/users/(.*)/$ modules/members/members_profile.php?id=$1 [L]

#Companies Profile Page
RewriteRule ^/(.*)$ modules/companies/companies_profile.php?id=$1
RewriteRule ^/(.*)/$ modules/companies/companies_profile.php?id=$1

What you wrote does not work because "^user/" never matches. Your URL is "/user/". ^ means begining of line. So what you have is not "beginning of line, user" but rather "begining of line, /, user".

1
  • Did that resolve your problem?
    – ETL
    Feb 20, 2013 at 19:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .