rewrite and POST data

Discuss practical ways rearrange URLs using mod_rewrite.

rewrite and POST data

Postby smakonin » Tue Jun 10, 2008 8:24 am

Hi,

I have been searching for days on how to fix this issue...

I have a website that has only one file index.php. All URLs are dynamics and index.php looks at the REQUEST_URI and serves up the right content. Here is part of my httpd.conf:

Code: Select all
<VirtualHost *:80>
    ServerAdmin someemail@domain.com
    ServerName xyz.domain.com
    DocumentRoot "/var/www/restful"

        <Directory "/var/www/restful">
            Options Indexes FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all

            RewriteEngine On
            RewriteBase /
            DirectoryIndex /index.php
            RewriteCond %{REQUEST_URI} !/index\.php
            RewriteRule ^(.*) /index.php [NC,L]
        </Directory>
</VirtualHost>


My issue it that $_POST is empty. Is there anyway around this?

Thanks,
Stephen.
smakonin
 
Posts: 3
Joined: Tue Jun 10, 2008 8:14 am

Postby smakonin » Tue Jun 10, 2008 11:55 am

Further info...

I have installed Live HTTP headers for Firefox and there is no redirecting happening after the post. $_SERVER show the following:
Code: Select all
.
.
.
[CONTENT_TYPE] => application/x-www-form-urlencoded
[CONTENT_LENGTH] => 0
.
.
.


Live HTTP headers logs:
Code: Select all
#request# POST http://xyz.domain.com/services/SMS_OR_MMS/sms
POST /services/SMS_OR_MMS/sms

----------------------------------------------

http://xyz.domain.com/services/SMS_OR_MMS/sms

POST /services/SMS_OR_MMS/sms HTTP/1.1
Host: xyz.domain.com
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.14) Gecko/20080418 Ubuntu/7.10 (gutsy) Firefox/2.0.0.14
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://xyz.domain.com/services/SMS_OR_MMS/sms
Cookie: debug_cookie=0;
Authorization: Basic ???????????????????
Content-Type: application/x-www-form-urlencoded
Content-Length: 0

HTTP/1.x 200 OK
Date: Tue, 10 Jun 2008 19:46:45 GMT
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.1.6
Content-Length: 1932
Connection: close
Content-Type: text/html; charset=UTF-8


My understanding is that $_POST will be lost in there are redirects, but this is not the case... I am puzzled.
smakonin
 
Posts: 3
Joined: Tue Jun 10, 2008 8:14 am

Postby smakonin » Wed Jun 11, 2008 7:44 am

I got it working I forgot to add name attribs to my form elements I only had ids. DUH!
smakonin
 
Posts: 3
Joined: Tue Jun 10, 2008 8:14 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 17 guests

cron