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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:28:03+00:00 2026-05-13T19:28:03+00:00

I tried to create a htaccess file that rewrites, for example the URL from

  • 0

I tried to create a htaccess file that rewrites, for example the URL from /index.php?type=car&model=audi&color=990000&year=1995 to /index/car/audi/990000/1995.

At the moment i use the following:

Options +FollowSymLinks
RewriteEngine On

RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+) $1.php?type=$2&model=$3&color=$4&year=$5

The problem is, it works fine when you fill in all the variables, but when you want all cars from “Audi” and keep the color and year empty, the page crashes. How can I change the mod so the page won’t crash and he get the right vars in the PHP?

  • 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-05-13T19:28:03+00:00Added an answer on May 13, 2026 at 7:28 pm

    At first glance I would change the + to * in your rule. + means One or more while * means zero or more. Also, you might need to make the / optional.

    EDIT:
    Try this:

    RewriteRule ^([^/]+)/?([^/]*)/?([^/]*)/?([^/]*)/?([^/]*) $1.php?type=$2&model=$3&color=$4&year=$5
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried to create jar file using command line that I inserted into java
I want to create a rule at the end of an .htaccess file that
I would like to create a .htaccess file that would do this logic: If
I have a site that currently serves results as example.com/index.php?show=foo and I'd like it
My .htaccess file contains url mappings and my script create these entries once a
I'm trying to create something short.com/ASWi7 -> short.com/index.php?h=ASWi7 so I tried using this code
I have tried create this table, but nothing I have tried works from FKs.
I tried to create a code that adds 2 percent each time a component
I would like to create rewrite rules in my .htaccess file to do the
I currently have the following htaccess <IfModule mod_rewrite.c> # redirect all calls to index.php

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.