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 7956801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:06:06+00:00 2026-06-04T04:06:06+00:00

The below mod rewrite doesn’t work.. For example with a url like http://www.mywebsite.com/category/general ..

  • 0

The below mod rewrite doesn’t work.. For example with a url like http://www.mywebsite.com/category/general .. I get a 404 error.

RewriteEngine On
RewriteBase /
RewriteRule ^category/([A-Za-z0-9-]+)&type=([A-Za-z0-9-]+)&r=([A-Za-z0-9-]+)&g=([A-Za-z0-9-]+)&page=([A-Za-z0-9-]+)/?$ /category.php?c=$1&type=$2&r=$3&g=$4&page=$5 [L]

If i use the mod rewrite below it works, shouldn’t there be a better way rather than having to type out all the combinations.

RewriteRule ^category/([A-Za-z0-9-]+)/?$ /category.php?c=$1 [L]
RewriteRule ^category/([A-Za-z0-9-]+)&type=([A-Za-z0-9-]+)/?$ /category.php?c=$1&type=$2 [L]
RewriteRule ^category/([A-Za-z0-9-]+)&page=([A-Za-z0-9-]+)/?$ /category.php?c=$1&page=$2 [L]
RewriteRule ^category/([A-Za-z0-9-]+)&type=([A-Za-z0-9-]+)&page=([A-Za-z0-9-]+)/?$ /category.php?c=$1&type=$2&page=$3 [L]
RewriteRule ^category/([A-Za-z0-9-]+)&r=([A-Za-z0-9-]+)/?$ /category.php?c=$1&r=$2 [L]
RewriteRule ^category/([A-Za-z0-9-]+)&type=([A-Za-z0-9-]+)&r=([A-Za-z0-9-]+)/?$ /category.php?c=$1&type$2&r=$3 [L]
RewriteRule ^category/([A-Za-z0-9-]+)&r=([A-Za-z0-9-]+)&page=([A-Za-z0-9-]+)/?$ /category.php?c=$1&r=$2&page=$3 [L]
RewriteRule ^category/([A-Za-z0-9-]+)&type=([A-Za-z0-9-]+)&r=([A-Za-z0-9-]+)&g=([A-Za-z0-9-]+)&page=([A-Za-z0-9-]+)/?$ /category.php?c=$1&type=$2&r=$3&g=$4&page=$5 [L]
  • 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-04T04:06:08+00:00Added an answer on June 4, 2026 at 4:06 am

    Your first rule set requires every argument to exist, so it is never triggering on your example URL. The second rule set appears to be working on your example because your first rule handles the “just has a word after ‘category/'” situation.

    If you want a single rule, try:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^category/([A-Za-z0-9-]+)(&type=([A-Za-z0-9-]+))?(&r=([A-Za-z0-9-]+))?(&g=([A-Za-z0-9-]+))?(&page=([A-Za-z0-9-]+))?/?$ /category.php?c=$1&type=$3&r=$5&g=$7&page=$9 [L]
    

    Or, since the arguments all appear to map directly:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^category/([A-Za-z0-9-]+)(&type=[A-Za-z0-9-]+)?(&r=[A-Za-z0-9-]+)?(&g=[A-Za-z0-9-]+)?(&page=[A-Za-z0-9-]+)?/?$ /category.php?c=$1&type=$2&r=$3&g=$4&page=$5 [L]
    

    Both of those assume that a) you’ll always have the first bit after “category/” and b) the remaining options can be mixed and matched but will always be in the same order. The second one is better because it means you can extend it in future if you want – the first one has run out of back-references (it uses $9).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using below rule to read the URL like URL: http://www.example.com/blog/sampe-post-title/10004/ RULE: RewriteRule
I use the below mod rewrite code for urls like: www.site.com/play/543 RewriteEngine On RewriteRule
I am trying to setup a mod rewrite rule to change urls like: http://www.site.com/play/4435
I am having a problem with my htaccess. when I use this url www.example.com/test
I have a below code in mod-rewrite.txt RewriteEngine On RewriteRule /\.htaccess$ - [F] RewriteCond
I'm using Apache2.2.17 and am trying to redirect the URL like below with the
I just came across this: http://www.askapache.com/htaccess/mod_rewrite-tips-and-tricks.html --> check under removing the query string. It
I am attempting to rewrite any URL with _excaped_fragment_=/some/directory to /some/directory?ajax=1. The code below
I want to hide index.php from the URL but it doesn't work at all.
I recently had a blog at www.andrewalaniz.com and I have moved it into a

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.