I have a PHP script that outputs different stuff based on GET parameters.
PHP code:
if((isset($_GET['channel'])) && (!isset($_GET['profile']) && !isset($_GET['c']) && !isset($_GET['b']) && !isset($_GET['highlight']) && !isset($_GET['broadcast']))){
echo 'Output1';
} elseif((isset($_GET['channel']) && isset($_GET['profile'])) && (!isset($_GET['c']) && !isset($_GET['b']) && !isset($_GET['highlight']) && !isset($_GET['broadcast']))) {
echo 'Output2';
} elseif((isset($_GET['channel']) && isset($_GET['c']) && isset($_GET['highlight'])) && (!isset($_GET['profile']) && !isset($_GET['b']) && !isset($_GET['broadcast']))) {
echo 'Output3';
} elseif((isset($_GET['channel']) && isset($_GET['b']) && isset($_GET['broadcast'])) && (!isset($_GET['profile']) && !isset($_GET['c']) && !isset($_GET['hightlight']))) {
echo 'Output4';
}
Current .htaccess:
RewriteEngine on
## If the request is for a valid directory
RewriteCond %{REQUEST_FILENAME} -d [OR]
## If the request is for a valid file
RewriteCond %{REQUEST_FILENAME} -f [OR]
## If the request is for a valid link
RewriteCond %{REQUEST_FILENAME} -l
## don't do anything
RewriteRule ^ - [L]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ ?channel=$1&b=$2&broadcast=$3 [L,QSA]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ ?channel=$1&c=$2&highlight=$3 [L,QSA]
RewriteRule ^([^/]+)/([^/]+)/?$ ?channel=$1&profile=$2 [L,QSA]
RewriteRule ^([^/]+)/?$ ?channel=$1 [L,QSA]
How I need it to work:
example.com/channel/c/12345 outputs "Output3"
example.com/channel/b/12345 outputs "Output4"
How it works now:
example.com/channel/c/12345 outputs "Output4"
example.com/channel/b/12345 outputs "Output4"
Are there any clever ways to make this work like I want it to?
Thanks in advance!