I bet this involves .htaccess more than php but I wasn't sure so I am posting here anyway.
I am trying to get a url with a random string at the end to redirect to a specific php page with the string appended as a GET variable. For example:
http://www.whatever.com/Google
Becomes
http://www.whatever.com/redirect.php?q=Google
But
http://www.whatever.com/
Goes to the index.php file.
Any help would be much appreciated.
Error 404 URL Redirection
Moderator: General Moderators
-
strangledspyder
- Forum Newbie
- Posts: 2
- Joined: Tue Mar 31, 2009 5:25 pm
Re: Error 404 URL Redirection
Yep, .htaccess.
Code: Select all
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* redirect.php?q=$0-
strangledspyder
- Forum Newbie
- Posts: 2
- Joined: Tue Mar 31, 2009 5:25 pm
Re: Error 404 URL Redirection
Thanks. I ended up using the following and it seems to work for what I want:
RewriteEngine on
RewriteRule ^([A-Za-z0-9]+)$ /redirect.php?site=$1
RewriteEngine on
RewriteRule ^([A-Za-z0-9]+)$ /redirect.php?site=$1