FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Redirecting through .htaccess.





CtrlAltDeleteDie
How would I redirect a user to a specific page if they were, say, using a PSP. Mozilla/4.0 (PSP (PlayStation Portable); 2.00)

I know there's a way, but I'm sure how to do it.
MrBlueSky
You can use something like:

Code:

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^Mozilla.*MSIE [456]\.0.*
RewriteRule ^$ yourareusingmicrosoft.html [L]


but I have to know the User-Agent string with which the PSP identifies itself to write a rule which redirects PSP's.
CtrlAltDeleteDie
So I would use:
Code:

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/4.0 (PSP (PlayStation Portable); 2.00)
RewriteRule ^$ yourareusingmicrosoft.html [L]


Mozilla/4.0 (PSP (PlayStation Portable); 2.00) - PSP's useragent.
MrBlueSky
Yep.

Although you might want to use this more general rule:

Code:

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/.*PSP.*
RewriteRule ^$ psppage.html [L]


to catch all versions.
Related topics
htaccess Password Protection
.htaccess tutorial
Few questions
Google and Domains: help
.htaccess instead of mod_rewrite
[PHP] Faking Shell Access Through PHP
Session globals through .htaccess
.htaccess -- redirecting an I.P. range
htaccess
How to redirect to a particular directory
HTML compressor
Limiting php file functions with .htaccess
Help! My CGI files are coming up as "not found!"
Joomla! 3.0 support
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.