Hi all, I am in need of some assistance in a rewrite line in my .htaccess. I have set up PDA access to my server running vbulletin and it picks up that a PDA has logged on and applies a particular style template. This works fine on my entry page where the .htaccess picks up a PDA and transfers it immediately to the forums index page and applies the style to the redirect URL. This script looks like this: RewriteEngine On RewriteCond %{HTTP_USER_AGENT} "Windows CE" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "NetFront" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "Palm OS" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "Blazer" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "Elaine" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "^WAP.*$" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "Plucker" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "AvantGo" [NC] RewriteRule ^(.*) /forums/index.php?styleid=7 [L,R] Code (markup): What I now want to happen is that if ANY page within the forums directory is accessed, it gets rewritten to apply the ?styleid=7 to the end of the URL (while removing any other style already there). This can happen in a number of instances: 1. The entry to the forums shows no filename eg. http://www.yorkshire-divers.com/forums/ 2. The page requested HAS a filename (e.g. http://www.yorkshire-divers.com/forums/index.php) 3. The page requested has a DIFFERENT style attached (e.g. http://www.yorkshire-divers.com/index.php?styleid=3 And so on - basically I want it to check every page requested within the forums directory, remove any styles already in the requested URL and apply the ?styleid=7 instead. Oh, and do I need to put this in my web root .htaccess or would it sit in a .htaccess within the /forums/ folder? Make sense? Hope so! Thanks in advance.
Ok - this is what I have tried but it doesn't work (obviously!). RewriteRule ^testforums/(.*).php(.*) /testforums/$1.php?styleid=7 [NC] Code (markup): An example would be Original URL: http://www.mydomain.com/testforums/index.php?styleid=3 Required URL: http://www.mydomain.com/testforums/index.php?styleid=7 Got to admit I'm making this up as I go along Any guidance? Thanks in advance Jay
Its located in my sub directory /forums/ and should apply to file requests within it, rewriting any URLs that DON'T have the ?styleid=7 appended at the end. It should also ignore .gif files and the two vbseo files: RewriteCond %{HTTP_USER_AGENT} "Windows CE" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "Blackberry" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "NetFront" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "Palm OS" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "Blazer" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "Elaine" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "^WAP.*$" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "Plucker" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "AvantGo" [NC] RewriteCond %{QUERY_STRING} "!.gif" [NC] RewriteCond %{QUERY_STRING} "!vbseo.php" [NC] RewriteCond %{QUERY_STRING} "!vbseo_getsitemap.php" [NC] RewriteCond %{QUERY_STRING} "!styleid=7" [NC] RewriteRule ^(.*)$ $1?styleid=7 [L,R] Code (markup):