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

  • Home
  • SEARCH
  • 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 9006061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:18:48+00:00 2026-06-16T01:18:48+00:00

.htacesss RewriteCond %{REQUEST_URI} ^/api/(.+)$ RewriteRule ^api/(.+)$ /index.php?api=%1 [QSA,L] example ajax url request: ‘http://hostname.com/api/ext/list.php?query=de’ I

  • 0

.htacesss

RewriteCond %{REQUEST_URI} ^/api/(.+)$
RewriteRule ^api/(.+)$ /index.php?api=%1 [QSA,L]

example ajax url request:
‘http://hostname.com/api/ext/list.php?query=de’

I want to be able to redirect urls in this format to the following
index.php?api={requested_filename}&param1=value1&param2=value2 …

because the whole site is processed through a bootstrap process in index.php which has a routing part loading configs, templates etc…

When I try a jquery code for example, the POST data is lost after redirect.

$.ajax({
            url: '/api/contact.php',
            type: 'POST',
            data: { 
                email: $("#contactEmail").val(),
                name: $("#contactName").val(),
                message: $("#contactMessage").val()
                                // etc ...
            }
});

I’ve read that you cannot preserve data on a http redirect. But how do all the frameworks avoid that? I’ve coded in many, and every one is bootstraped through the index.php and there are rewrite rules in the .htaccess file for enabling pretty urls. So in Yii for example, I would call an url “api/uploads/latests.json” with some POST data and the controllers on the backend would receive that data. What am i missing here?

note: I’ve tested the [P] mod_rewrite parameter, and i think that this server doesn’t have mod_proxy enabled.

  • 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-16T01:18:49+00:00Added an answer on June 16, 2026 at 1:18 am

    There is a difference between a rewrite and a redirect.

    Rewrite is an apache (and other servers) module that will follow a set of cond/rules to map a requested url to files on the server (ex: a bootstrap rewrites all urls to a single file, usually index.php. A mvc might map /model/controller/view uri to an index.php that calls the appropriate mvc files).

    A redirect actually changes the page you are on. Someone requests page A.php and that page says “what you are looking for is on B.php” and so your browser goes to B.php.

    A rewrite will preserve post parameters because the url doesn’t change. A rewrite will just change the script being requested, but to the browser it looks like the page still exists at the requested url.

    A redirect will not preserve post parameters because the server will redirect you to another page completely.

    What it appears you are trying to do is a rewrite, not a redirect. You should have no problems getting the post parameters.

    To fix this, how are you checking in index.php that there are no post parameters? Are you sure the controller you are expecting is getting called?

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

Sidebar

Related Questions

I have a .htacess file like ; RewriteRule ^(.*)$ index.php/$1 [NC,QSA,L] Let say I
How to make this with htacess: http://example.com/category => /index.php?action=category http://example.com/category?query=string => /index.php?action=category&query=string http://example.com/category/subcategory =>
When I set my WordPress site's address (URL) setting to = http://www.example.com , then
How can I achieve the URL pattern when the form is submitted index.php <form
Iam trying to rewrite my URL http://givehands.co.in/post.php?p=post&id=1 to http://givehands.co.in/post/1/ using htacess. But it gets
I have htacess rule like this: RewriteRule ^([A-z])([0-9]+)-([^/]*)?$ index.php?tt=$1&ii=$2&ll=$3 Is there any PHP function
I want to be able to create the url: http://example.com/+/user Is it possible using
How can I remove index.php from url in wordpress on IIS 2.0 server. my
This is my htacess file: RewriteEngine on RewriteCond %{HTTP_HOST} !^www\. RewriteCond %{HTTP_HOST} ^(.*)\.mydomain\.com(.*) RewriteRule
I am trying to protect an index.php page of a subfolder with .htaccess. The

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.