使用重定向技术

i want to redirect users to my site based on the url they typed into the address bar but i am problems as what to actually do. forgive me if i am not using the right term, i am a newbie.

this an example of what i want to achieve

www.mysite.com (is my site) www.mysite.com/pizza (is what the user typed)

i want the browser to take the user to www.mysite.com if he types www.mysite.com and redirect the user to www.mysite.com/base/tweek.php?ref=pizza if he types www.mysite.com/pizza.

how do i do this?

Try adding this to the htaccess file in your document root:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)$ /base/tweek.php?ref=$1 [L]

Also make sure you have mod_rewrite loaded.

You must create the .htaccess file in the root directory of the page, and write:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /base/tweek.php?ref=$1 [L,QSA]

I think (handwritten, not checked :) ). Hope it helps, if You have any problems, try to read some htaccess tutorial.

Just use header at the top from your index.php:

header('Location: anotherindex.php');