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

The Archive Base Latest Questions

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

first, sorry for my bad English. I try to rewrite url generated from Form

  • 0

first, sorry for my bad English.

I try to rewrite url generated from Form Get and redirect that.

my url is like this:

http://www.mysite.com/properties?action=search&agreement=for-rent&category=my-category&type=&zone=my-zone&city=my-city

and I have this .htaccess configured:

11. RewriteCond %{QUERY_STRING} ^action=(?:[a-zA-Z\-]*)&(?:.*)=([a-zA-Z\-]*)&(?:.*)=([a-zA-Z\-]*)&(?:.*)=([a-zA-Z\-]*)&(?:.*)=([a-zA-Z\-]*)&(?:.*)=([a-zA-Z\-]*)$
12. RewriteRule (.*) %{REQUEST_URI}/%1/%2/%3/%4/%5/? [R=301,L]

So basically all my request are direct to index.php.

21. RewriteCond %{REQUEST_URI} !index\.php|resources|hidden
22. RewriteRule ^(.*)$ index.php/$1 [L]

All works, but the problem is when I have an empty value in query string, the rule add double slash and the above url (for example whit &type=&zone=my-zone… type have empty value) will translate like that:

http://www.mysite.com/for-rent/my-category//my-zone/my-city/

The question is: How can i remove in .htaccess the double slash generated if i have one or more empty value in query string?

Thanks

  • 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-04T14:38:19+00:00Added an answer on June 4, 2026 at 2:38 pm

    Easiest is to do another redirect (not real pretty as it requires two 301’s).

    RewriteCond %{THE_REQUEST} //
    RewriteRule .* $0 [R=301,L]
    

    The fun part is that when the url is loaded with a double slash in it, mod_rewrite will automatically remove this. So as you can see above you’ll just have to rewrite the url to itself, kind of.

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

Sidebar

Related Questions

At first sorry my bad English. I want define routing for this url: For
First, sorry for my bad English. I'm trying to get an IP from user.
First, sorry for my bad english. I have an EF entity that looks like:
first of all... i'm italian, so i'm sorry for my bad english! so... this
First : Appologize for my bad english. Sorry for this newbie software question, but
first of all sorry by my bad english, Hello i am new in this
First, sorry for my bad english. I would like when one people click on
First of all, sorry for my bad english. I'll try to explain my question:
first, sorry for the bad english. I have a test that submit a login
First sorry for my bad English. I have this menubar in PHP. I want

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.