How to Redirect a Page on GET URL

126
March 27, 2019, at 6:30 PM

I have a page like this index.php?controller=a&action=b, but on this page controller=a i did nothing, if i access it just a blank page. I need to redirect from controller=a to original page controller=a&action=b?

Answer 1

What if just check the page url and redirect,

if(isset($_GET['controller']) && $_GET['controller'] == "a"){
    header("location: index.php");
}
Answer 2

Your question is confusing... i will try my best to help, here's a site that might help you:

https://www.htaccessredirect.net/

Another suggestion that might help in .htaccess is the following:

RewriteRule ^controller/([0-9A-z_-]+)\/action/([0-9A-z_-]+)\/$ index.php?controller=$1&action=$2 [QSA,L,NC]

this way you might use link www.domain.com/controller/a/action/b/ to access index.php?controller=a&action=b

Rent Charter Buses Company
READ ALSO
How to authenticate Laravel app user using a database user?

How to authenticate Laravel app user using a database user?

I want to use MariaDB (mysql) users to authenticate in a Laravel appSo instead of having a users table and a single database user for the whole application I want each login to be a separate database user and have permissions managed by the database

175
PHP - Not entering on the loop if route returns a string

PHP - Not entering on the loop if route returns a string

Im setting a small webservice that should return true if it finds the user, on the DB, and false if it doesn'tBut its allways returning false

135
Openssl decryption ( DES ) returns false in PHP

Openssl decryption ( DES ) returns false in PHP

I'm trying to decrypt data with DES-ECB encryption, but the response is always false

193
How to include <?php echo esc_html($product->get_review_count()); ?> in function.php?

How to include <?php echo esc_html($product->get_review_count()); ?> in function.php?

I'd like to add :<?php echo esc_html($product->get_review_count()); ?> in my function which is :

151