Welcome to WebmasterWorld Guest from 188.8.131.52 , register , free tools , login , search , subscribe , help , library , announcements , recent posts , open posts Pubcon Website
Help fix my redundant .htaccess :) aaron1259 msg:4441472 2:05 pm on Apr 16, 2012 (gmt 0) Is there anyway I can make this less redundant: RewriteEngine On RewriteRule anime-websites ?index.php&category=1 [NC] RewriteRule Allods-Online ?index.php&category=61 [NC] RewriteRule dragonica ?index.php&category=60 [NC] RewriteRule gaming-websites ?index.php&category=2 [NC] RewriteRule grand-theft-auto ?index.php&category=3 [NC] RewriteRule the-sims ?index.php&category=4 [NC] RewriteRule Battlefield ?index.php&category=5 [NC] RewriteRule Call-Of-Duty ?index.php&category=6 [NC] RewriteRule Counter-Strike ?index.php&category=7 [NC] RewriteRule Doom ?index.php&category=8 [NC] RewriteRule FarCry ?index.php&category=9 [NC] RewriteRule Half-Life ?index.php&category=10 [NC] RewriteRule Unreal-Tournament ?index.php&category=11 [NC] RewriteRule Nintendo-Wii ?index.php&category=12 [NC] RewriteRule PlayStation ?index.php&category=13 [NC] RewriteRule PSP ?index.php&category=14 [NC] RewriteRule xBox ?index.php&category=15 [NC] RewriteRule Aion-Online ?index.php&category=16 [NC] RewriteRule Cabal-Online ?index.php&category=17 [NC] RewriteRule Conquer-Online ?index.php&category=18 [NC] RewriteRule Dark-Age-of-Camelot ?index.php&category=19 [NC] RewriteRule Dekaron ?index.php&category=20 [NC] RewriteRule EverQuest ?index.php&category=21 [NC] RewriteRule Final-Fantasy ?index.php&category=22 [NC] RewriteRule Flyff-Online ?index.php&category=23 [NC] RewriteRule Grand-Chase ?index.php&category=24 [NC] RewriteRule Guild-Wars ?index.php&category=25 [NC] RewriteRule Gunbound ?index.php&category=26 [NC] RewriteRule Helbreath ?index.php&category=27 [NC] RewriteRule Jade-Dynasty ?index.php&category=28 [NC] RewriteRule Kal-Online ?index.php&category=29 [NC] RewriteRule Knight-Online ?index.php&category=30 [NC] RewriteRule Legend-of-Mir ?index.php&category=31 [NC] RewriteRule Lineage2 ?index.php&category=32 [NC] RewriteRule Luna-Online ?index.php&category=33 [NC] RewriteRule MapleStory ?index.php&category=34 [NC] RewriteRule Matrix-Online ?index.php&category=35 [NC] RewriteRule MMORPG-&-MPOG ?index.php&category=36 [NC] RewriteRule Mu-Online ?index.php&category=37 [NC] Thanks!
lucy24 msg:4441512 3:22 pm on Apr 16, 2012 (gmt 0)
Only by rewriting it all to a php script that pulls the appropriate category number and slaps it in place in the pattern. If so, you can make a single RewriteRule that grabs any extensionless request. Last thing in the php will then be to serve up a 404 to anything that wasn't on the list. All those rewrites should have an [L] flag instead of-- not in addition to-- the [NC]. The [NC] is fine when you're issuing a Redirect, in fact it can be good, but you don't want it when rewriting. It puts you face to face with the Duplicate Content demon. The only exception to [L] is if there will be further Rewrites after this batch. But that's a pretty awful possibility. g1smd msg:4441513 3:23 pm on Apr 16, 2012 (gmt 0)
The leading ? on the target path is concerning. Surely you mean
here? Every rule should have the [L] flag. Are you sure you want the NC flag? It means that URL requests of any case will return content - Duplicate Content. Ah. We're almost in agreement. :) The rewrite to a special PHP script to sort out what was requested is only useful when that special script is going to send a redirect response, i.e. it's of no use in this thread.
aaron1259 msg:4441718 11:48 pm on Apr 16, 2012 (gmt 0)
I also had another problem, when ever I went to a Rewritten url e.g "example.com/?index.php&cat=13" = "example.com/game-list", whenever I went to another URL that wasn't in .htaccess it went from the Rewritten URL I was on and added the unwritten one at the end. e.g I surfing "example.com/game-list" and click the register link (which isn't in .htaccess) and it takes me to "example.com/game-list?register.php" which wont exist. lucy24 msg:4441728 12:32 am on Apr 17, 2012 (gmt 0)
:: peering into crystal ball :: You've got relative links on your pages. Can't do that if you're rewriting. g1smd msg:4441743 1:24 am on Apr 17, 2012 (gmt 0)
All links to other parts of the site should start with a leading slash and include the full path to the resource or page.