The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Mod Rewrite expert, I need help

Discussion in 'General Discussion' started by sodapopinski, Oct 19, 2015.

  1. sodapopinski

    sodapopinski Well-Known Member

    Aug 13, 2001
    Likes Received:
    Trophy Points:
    I want to set a website where user can get

    Lets say my domain is and I already activated wild card setting into the httpd.conf config.

    What I want:

    1. When accessed, the server will process

    2. When accessed, the server will process

    (note abc, 1 and rose are the any number and words depending on user type in browser)

    I tried the following config:
    RewriteCond %{HTTP_HOST} ^((?!www\.)[^.]+)\.domain\.com$
    RewriteCond %{REQUEST_URI} !^/index\.php$ [NC]
    RewriteRule ^(.*)$ /index.php?user=%1
    RewriteRule ^productid_([0-9]+)_([0-9a-z-]).html$ /index.php?prodid=$1&prodname=$2&user=%1

    But, it doesnt work. When opening, it will open the default page.
    If I removed rule: RewriteRule ^(.*)$ /index.php?user=%1, the rule for works well, BUT failed to load into the browser.
    So, How can make both of these rule work?

    Anybody have the idea? I'm willing to send some $ by paypal if the code works ;p

    Thank you very much.
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Apr 11, 2011
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    Hello :)

    You will likely receive more user-feedback on custom Mod_Rewrite rules on a website where more discussions of Mod_Rewrite occur, such as StackOverflow.

    Thank you.

Share This Page