How Do I make a simple .htaccess internal redirect Catch All script while forwarding POST data?

Posted by RB on Stack Overflow See other posts from Stack Overflow or by RB
Published on 2009-10-14T00:20:19Z Indexed on 2010/04/13 1:02 UTC
Read the original article Hit count: 399

Filed under:
|
|
|
|

I just want to catch all requests and forward them internally to my catchall page with all POST data intact

Catch all page: http://www.mydomain.com/addons/redirect/catch-all.php

I've tried so many combinations, but my server doesn't want to redirect internally if I specify more than catch-all.php

# Internally redirect all pages to "Catch" page
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) /addons/redirect/catch-all.php [L]

Also, do I need [L] or is it useless for internal redirects?

Then, what php code would I use to grab the POST data, use it, and finally PHP redirect the page to the originally requested page

Would it be done just as normal by using $_POST['variable_name']; or something different? Then, how would I go about calling the originally requested page, so I can tell PHP to header location direct them to that page?

Thanks!

UPDATE:

Ha sick, nevermind. The condition DOES work. Here's my code:

# Internally redirect all pages to "Catch" page
Options +FollowSymLinks
RewriteEngine on

RewriteCond %{REQUEST_URI} !^/robots.txt$ 
RewriteCond %{REQUEST_URI} !\.(gif¦jpe?g¦png¦css¦js¦pdf¦doc¦xml)$

RewriteCond %{REQUEST_URI} !^/addons/redirect/catch-all\.php$
RewriteRule (.*)$ /addons/redirect/catch-all.php?q=$1 [L]

Thanks guys for the inspiration! Now time to get that PHP to work...

© Stack Overflow or respective owner

Related posts about .htaccess

Related posts about internal