Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8668805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:18:19+00:00 2026-06-12T18:18:19+00:00

I am using mod rewrite in an .htaccess file to change the URL to

  • 0

I am using mod rewrite in an .htaccess file to change the URL to a nicer one, it converts this:

http://domain.com?a=test&v=page&id=3

to

http://domain.com/test/page/3

using this condition

RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)?$ index.php?a=$1&v=$2&id=$3 [L]

I want to do something different if $1 == cart and $2 == home

Here is some pseudo code for the idea using a php if condition

if($1 == 'cart' && $2 == 'home'){
   here I want to do a different rewrite rule
}else{
   RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)?$ index.php?a=$1&v=$2&id=$3 [L]
}

Any idea as to how I go about that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T18:18:20+00:00Added an answer on June 12, 2026 at 6:18 pm

    2 rewrite rules, with the predefined one first:

    RewriteRule ^cart/home/([^/\.]+)?$            page2.php?id=$1 [L]
    RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)?$  index.php?a=$1&v=$2&id=$3 [L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .htaccess file and am using mod rewrite to redirect /tags to
Quick one. I'm using mod rewrite and have most replacements in place: empty space
I've been using mod_rewrite in my htaccess file to rewrite my urls and I've
I am using htaccess to rewrite my URL's... with codeigniter, to be specific. I
I'm wanting to rewrite Word Press urls using mod_rewrite in my .htaccess file in
I am using apache's mod_rewrite module to improve my URL structure(for one instance- www.mydomainname.com/user.php?u=somename
I'm setting up some simple url rewriting rules using mod_rewrite and a .htacces file,
I'm using Mod Rewrite for IIS 7.0 from iis.net and want to redirect requests:
I am using a .htaccess file to direct requests for a directory to a
I have an .htaccess file using mod_rewrite to redirect URLs from the old website

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.