saghir69
08-11-2005, 11:25 AM
all i want is to redirect all hits
at http://www.funandgamesonly.com/
or http://www.funandgamesonly.com/index.php
to
http://www.funandgamesonly.com/1.php
can someone please help?
Dan L
08-11-2005, 12:21 PM
index.php:<?php header('Location: 1.php'); ?>
saghir69
08-11-2005, 12:24 PM
^ thanks,
but do u know how to do it using mod rewrite.
Dan L
08-11-2005, 12:58 PM
Why do you need mod_rewrite?
saghir69
08-11-2005, 01:01 PM
because the site has tracking code for refferers, and if i use the above code the refferer would change to http://www.funandgamesonly.com/ and tracking wouldn't work.
Dan L
08-11-2005, 01:03 PM
<?php header('Location: 1.php?'.$_SERVER['QUERY_STRING']); ?> Try that. :)
saghir69
08-11-2005, 01:30 PM
another reason for wanting to use mod rewrite is that
1.php
2.php and so on
are dynamic pages, driven from index.php , but i only want the redirect to work on index.php
Dan L
08-11-2005, 02:02 PM
I can't really help you since you aren't explaining your problem in full.
How does it know whether to redirect to 1.php or 2.php?
saghir69
08-11-2005, 02:52 PM
well all i want to do is to redirect trafic from
index.php to 1.php (but 1.php is really index.php?page=1)
I already have a pagination script that is doing the redirecting to 2.php , 3.php and so on...
basically i want to abandon the use of index.php and redirect the traffic to 1.php, as they both produce the same page.
did that make sense?
and i think the code below
<?php header('Location: 1.php'); ?>
will not work as it would run for all pages, which are created from index.php
ie.
2.php is really index.php?page=2
and
3.php is really index.php?page=3
so thats why i want a off page solution.
Dan L
08-11-2005, 03:07 PM
RewriteEngine On
RewriteBase /
RewriteRule page/([0-9A-Za-z\.]+) /index.php?page=$1 [QSA]
This will convert domain.com/page/1 into domain.com/index.php?page=1
There really shouldn't be a .php on the end of the rewritten URL, since half the point of mod_rewrite is to remove any part of the URL that could change over time.