Page 1 of 1

Redirect PHP page with attributes

Posted: Wed Sep 20, 2006 12:44 pm
by cdickson
Is there any way to redirect a PHP page with attributes?

I'm trying to redirect index.php to index.php?level=slideshow&mode=album&id=1 using the .htaccess file, but it isn't working.

The trouble could be in my syntax, but I'm wondering if it won't work because the page is really redirecting to itself, just with attributes added.

One of the many redirects I've attempted:

Code: Select all

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^www.domain.com/gallery/index.php [nc]
rewriterule ^(.*)$ http://www.domain.com/gallery/index.php?level=slideshow&mode=album&id=1$1 [r=301,nc]
I also tried:

Code: Select all

RewriteEngine  on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE}  [NC]
RewriteRule ^http://www\.domain\.com/gallery/index\.php$  [L]

RewriteCond %{HTTP_USER_AGENT}  ^Mozilla/[345].*Gecko*
RewriteRule ^http://nickwhite\.server319\.com/gallery/index\.php$ http://www.domain.com/gallery/index.php?level=slideshow&mode=album&id=1 [L]

RewriteCond %{HTTP_USER_AGENT}  ^Mozilla/[345].*MSIE*
RewriteRule ^http://nickwhite\.server319\.com/gallery/index\.php$ http://www.domain.com/gallery/index.php?level=slideshow&mode=album&id=1 [L]

Posted: Wed Sep 20, 2006 12:53 pm
by n00b Saibot
how does this go...?

Code: Select all

if(count($_GET) == 0)
 header('Location: index.php?level=slideshow&mode=album&id=1');

Posted: Wed Sep 20, 2006 1:06 pm
by cdickson
Thanks n00b Saibot! Works perfectly.