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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:54:01+00:00 2026-05-25T13:54:01+00:00

Question regarding redirection using htaccess. On a GET search form submit I get the

  • 0

Question regarding redirection using htaccess. On a GET search form submit I get the following url:

http://www.example.com/search/?criteria=foo&filter=all&date=all&submit=search&page=1

The above works fine. Then I have this rewrite rule in my htaccess:

RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/$ search.php?criteria=$2&filter=$3&date=$4&submit=$1&page=$5 [L]

The above also works fine. It allows me to use the following structure for my search results:

http://www.example.com/search/foo/title/all/1/

Now my question is when I click submit I would like it to use the new clearner url structure however it uses the messier one with the question marks and the equal signs. Now automatically I was thinking maybe I have to do a redirect in PHP however if I can do it with htaccess I would be happier as it means cleaner code.

I also understand I can do this with JavaScript by intercepting the click and creating the seo friendly url but again if their is a way with htaccess I would prefer that.

Hope you understand what im trying to achieve and many thanks for reading,

fl3x7

p.s im pretty new to htaccess so if you can explain/ guide etc that would be great

  • 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-25T13:54:01+00:00Added an answer on May 25, 2026 at 1:54 pm

    You cannot do it solely with .htaccess.

    You can do it with javascript (intercept the onclick event, construct the url string using the user entered data then redirect the page to this url), but this is not really reliable considering that javascript runs on the client side.

    My suggestion is to use PHP for this. The process is the same, but I’ll use POST instead of GET as a method for the form. Before the page gets rendered, detect the $_POST data and construct the $url using it. Then redirect the page to that $url, using header("Location: ".$url); It will be best to use exit(); after this, to make sure that the code below it will not get executed as the redirect is made.

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

Sidebar

Related Questions

Quick question regarding memory management in C++ If I do the following operation: pointer
Following my question regarding a .NET YAML Library ... as there doesn't seem to
I have a small question regarding rails. I have a search controller which searches
One question regarding whether the following code should yield a compiler warning or not
Following my previous question regarding the rationale behind extremely long functions, I would like
A question regarding the repository pattern and query object pattern. I'm using EF 4
Quick question regarding EventHandlers in C#, let's say we have the following code: MyObject.MyEventHandler
I've a question regarding Build Servers for .NET Projects. Currently I'm using TeamBuild in
A question regarding Rails associations. Consider the following models: People Events Images People and
Following a previous question regarding ActiveMQ and WebSockets, I would like to know if

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.