Ok. So here`s the deal. I`m a htaccess noob and i also have a problem that my small brain can`t handle with after reading few tutorials. The biggest problem is I need a solution and I need it fast My htaccess file looks like this : Options +FollowSymLinks RewriteEngine On # 301 redirect to domain without 'www.' RewriteCond %{HTTP_HOST} ^www.somesite.com$ [NC] RewriteRule ^(.*)$ http://somesite.com/$1 [R=301,L] # works RewriteRule ^tutorial$ index.php?page=tutorial [L] # doesnt work why?? RewriteRule ^tutorial_about$ index.php?page=tutorial_about [L] # doesnt work why?? RewriteRule ^tutorial_post$ index.php?page=tutorial_post [L] # doesnt work why?? RewriteRule ^tutorial_business$ index.php?page=tutorial_business [L] # doesnt work why?? RewriteRule ^tutorial_advertise$ index.php?page=tutorial_advertise [L] RewriteRule ^copyright$ index.php?page=copyright [L] RewriteRule ^about_us$ index.php?page=about_us [L] RewriteRule ^advertising$ index.php?page=advertising [L] RewriteRule ^contact_us$ index.php?page=contact_us [L] RewriteRule ^privacy_policy$ index.php?page=privacy_policy [L] RewriteRule ^send_feedback$ index.php?page=send_feedback [L] RewriteRule ^sitemap$ index.php?page=sitemap [L] RewriteRule ^terms_of_use$ index.php?page=terms_of_use [L] RewriteRule ^business/edit/([a-z(-.*)]+)$ index.php?page=business&action=edit&url=$1 [L] RewriteRule ^business/view/([a-z(-.*)]+)$ index.php?page=business&action=view&url=$1 [L] #RewriteRule ^register$ index.php?page=register #RewriteRule ^login$ index.php?page=login #RewriteRule ^logout$ index.php?page=logout RewriteRule ^user/panel$ index.php?page=user&action=panel [L] RewriteRule ^map/view/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)$ index.php?page=map&action=view&country=$1&state=$2&city=$3&borough=$4&kiosk=$5 [L] RewriteRule ^map/view/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)$ index.php?page=map&action=view&country=$1&state=$2&city=$3&borough=$4 [L] RewriteRule ^map/view/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)$ index.php?page=map&action=view&country=$1&state=$2&city=$3 [L] RewriteRule ^map/view$ index.php?page=map&action=view [L] RewriteRule ^map/post/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)$ index.php?page=map&action=post&country=$1&state=$2&city=$3 [L] RewriteRule ^map/post$ index.php?page=map&action=post [L] RewriteRule ^notice/remove/([0-9]+)/(.*)$ index.php?page=notice&action=remove&id=$1&key=$2 [L] RewriteRule ^notice/edit/([0-9]+)/(.*)$ index.php?page=notice&action=edit&id=$1&key=$2 [L] RewriteRule ^notice/view/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([0-9]+)$ index.php?page=notice&action=view&country=$1&state=$2&city=$3&borough=$4&kiosk=$5&id=$6 [L] RewriteRule ^search/?$ index.php?page=search # doesnt work why?? #RewriteRule ^search/(page)?$ index.php?page=search [L] # doesnt work why?? #RewriteRule ^search/page/([0-9])+$ index.php?page=search&limitstart=$1 [L] RewriteRule ^kiosk/browse/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)$ index.php?page=kiosk&action=browse&country=$1&state=$2&city=$3&borough=$4&kiosk=$5 [L] RewriteRule ^kiosk/view/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)$ index.php?page=kiosk&action=view&country=$1&state=$2&city=$3&borough=$4&kiosk=$5 [L] RewriteRule ^kiosk/post/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([0-9]+)$ index.php?page=kiosk&action=post&country=$1&state=$2&city=$3&borough=$4&kiosk=$5&step=$6 [L] RewriteRule ^kiosk/post/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)$ index.php?page=kiosk&action=post&country=$1&state=$2&city=$3&borough=$4&kiosk=$5 [L] RewriteRule ^noticebag/remove/([0-9]+)$ index.php?page=noticebag&action=remove&id=$1 [L] RewriteRule ^noticebag/edit/([0-9]+)$ index.php?page=noticebag&action=edit&id=$1 [L] RewriteRule ^noticebag/checkout$ index.php?page=noticebag&action=checkout [L] RewriteRule ^noticebag/view$ index.php?page=noticebag&action=view [L] RewriteRule ^noticebag$ index.php?page=noticebag&action=view [L] Code (markup): There are two sections that doesn`t seem to work : - tutorial ( needed address : tutorial, tutorial_post,etc about_us and other like that one work fine :/) - search with limitstart param ( needed address is : search/page/x where x is limitstart param ) Any help would be appreciated. Thanks in advance.
I'd remove: # works RewriteRule ^tutorial$ index.php?page=tutorial [L] # doesnt work why?? RewriteRule ^tutorial_about$ index.php?page=tutorial_about [L] # doesnt work why?? RewriteRule ^tutorial_post$ index.php?page=tutorial_post [L] # doesnt work why?? RewriteRule ^tutorial_business$ index.php?page=tutorial_business [L] # doesnt work why?? RewriteRule ^tutorial_advertise$ index.php?page=tutorial_advertise [L] Code (markup): Replace with: # works RewriteRule ^(tutorial.*)$ index.php?page=$1 [L] Code (markup): Then: RewriteRule ^search/?$ index.php?page=search # doesnt work why?? #RewriteRule ^search/(page)?$ index.php?page=search [L] # doesnt work why?? #RewriteRule ^search/page/([0-9])+$ index.php?page=search&limitstart=$1 [L] Code (markup): To: RewriteRule ^search/page/([0-9]+)$ index.php?page=search&limitstart=$1 [L] RewriteRule ^search(/|page)?$ index.php?page=search [L] Code (markup): I've not tested so let me know how you get on, I'm pretty sure you can optimise a fair amount of the rules there.
First Thanks for trying to help Second i replaced the rules You showed me and kaboom - not working :/ I removed all rules and left just the three and still not working :/ I have no clue why this does not work ... ( beside the fact that I lack proper knowledge ) ( hard linking : index.php?page=tutorial and etc works fine)
RewriteEngine On RewriteRule ^(tutorial.*)$ index.php?page=$1 [L] Code (markup): That doesn't work for rewriting the tutorial pages?
How long does it take to new htaccess rules to kick in?? I tried several variants and suddenly it started working. Unfortunately when i added rest of the rules search still wasn't working and copyright too ;/ I can`t find the source of the problem. But tutorial is a go current setup : Options +FollowSymLinks RewriteEngine On # 301 redirect to domain without 'www.' RewriteCond %{HTTP_HOST} ^www.somesite.com$ [NC] RewriteRule ^(.*)$ http://somesite.com/$1 [R=301,L] #works RewriteRule ^(tutorial.*)$ index.php?page=$1 [L] #doesnt work RewriteRule ^search(/|page)?$ index.php?page=search [L] #doesnt work RewriteRule ^search/page/([0-9]+)$ index.php?page=search&limitstart=$1 [L] #works RewriteRule ^about_us$ index.php?page=about_us [L] #works RewriteRule ^advertising$ index.php?page=advertising [L] #doesnt work RewriteRule ^copyright$ index.php?page=copyright [L] Code (markup): ... etc as above ( without search rules ) Update : i tried movig search rules from to to the place they used to be. Effect : search with old rule : RewriteRule ^search/?$ index.php?page=search [L] is working new rules for search aren`t and guess... tutorial stopped working. I`m clueless... Help
RewriteEngine On RewriteRule ^(tutorial.*)$ index.php?page=$1 RewriteRule ^search/page/([0-9]+)$ index.php?page=search&limitstart=$1 RewriteRule ^search(/|/page)?$ index.php?page=search RewriteRule ^([a-z_]+)$ index.php?page=$1 Code (markup): That works for tutorials, search and copyright etc on my test server.
Thanks for Your help. ( the last rule is briliant simplifies much but i can`t use it since it doesn`t work in that particular case ) I tested many rules in many configurations and i figured out that certain rules work in certain places and in other not :/ ( maybe someone will tell me why ??) Final config with all required rules working : Options +FollowSymLinks RewriteEngine On # 301 redirect to domain without 'www.' RewriteCond %{HTTP_HOST} ^www.somesite.com$ [NC] RewriteRule ^(.*)$ http://somesite.com/$1 [R=301,L] RewriteRule ^search(/|/page)?$ index.php?page=search RewriteRule ^(tutorial.*)$ index.php?page=$1 RewriteRule ^about_us$ index.php?page=about_us [L] RewriteRule ^advertising$ index.php?page=advertising [L] RewriteRule ^contact_us$ index.php?page=contact_us [L] RewriteRule ^privacy_policy$ index.php?page=privacy_policy [L] RewriteRule ^send_feedback$ index.php?page=send_feedback [L] RewriteRule ^sitemap$ index.php?page=sitemap [L] RewriteRule ^terms_of_use$ index.php?page=terms_of_use [L] RewriteRule ^copyright$ index.php?page=copyright [L] RewriteRule ^business/edit/([a-z(-.*)]+)$ index.php?page=business&action=edit&url=$1 RewriteRule ^business/view/([a-z(-.*)]+)$ index.php?page=business&action=view&url=$1 RewriteRule ^user/panel$ index.php?page=user&action=panel [L] RewriteRule ^map/view/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)$ index.php?page=map&action=view&country=$1&state=$2&city=$3&borough=$4&kiosk=$5 [L] RewriteRule ^map/view/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)$ index.php?page=map&action=view&country=$1&state=$2&city=$3&borough=$4 [L] RewriteRule ^map/view/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)$ index.php?page=map&action=view&country=$1&state=$2&city=$3 [L] RewriteRule ^map/view$ index.php?page=map&action=view [L] RewriteRule ^map/post/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)$ index.php?page=map&action=post&country=$1&state=$2&city=$3 [L] RewriteRule ^map/post$ index.php?page=map&action=post [L] RewriteRule ^notice/remove/([0-9]+)/(.*)$ index.php?page=notice&action=remove&id=$1&key=$2 [L] RewriteRule ^notice/edit/([0-9]+)/(.*)$ index.php?page=notice&action=edit&id=$1&key=$2 [L] RewriteRule ^notice/view/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([0-9]+)$ index.php?page=notice&action=view&country=$1&state=$2&city=$3&borough=$4&kiosk=$5&id=$6 [L] RewriteRule ^kiosk/browse/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)$ index.php?page=kiosk&action=browse&country=$1&state=$2&city=$3&borough=$4&kiosk=$5 [L] RewriteRule ^kiosk/view/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)$ index.php?page=kiosk&action=view&country=$1&state=$2&city=$3&borough=$4&kiosk=$5 [L] RewriteRule ^kiosk/post/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([0-9]+)$ index.php?page=kiosk&action=post&country=$1&state=$2&city=$3&borough=$4&kiosk=$5&step=$6 [L] RewriteRule ^kiosk/post/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)$ index.php?page=kiosk&action=post&country=$1&state=$2&city=$3&borough=$4&kiosk=$5 [L] RewriteRule ^search/page/([0-9])+$ index.php?page=search&limitstart=$1 RewriteRule ^noticebag/remove/([0-9]+)$ index.php?page=noticebag&action=remove&id=$1 [L] RewriteRule ^noticebag/edit/([0-9]+)$ index.php?page=noticebag&action=edit&id=$1 [L] RewriteRule ^noticebag/checkout$ index.php?page=noticebag&action=checkout [L] RewriteRule ^noticebag/view$ index.php?page=noticebag&action=view [L] RewriteRule ^noticebag$ index.php?page=noticebag&action=view [L] Code (markup): Once again Many thanks tolra ohh and one more question : What with [L] marker should i leave it or remove or add to all ?
The order is important which is why what I gave you on it's own will just work but once you start adding in more then it need adjusting. Moving RewriteRule ^([a-z_]+)$ index.php?page=$1 to the bottom should get rid of all those about_us, advertising and so on rules, it's really a catch all. As for the [L] depends. I think the following should work: Options +FollowSymLinks RewriteEngine On # 301 redirect to domain without 'www.' RewriteCond %{HTTP_HOST} ^www.noticekiosk.com$ [NC] RewriteRule ^(.*)$ http://noticekiosk.com/$1 [R=301,L] RewriteRule ^(tutorial.*)$ index.php?page=$1 RewriteRule ^search/page/([0-9]+)$ index.php?page=search&limitstart=$1 RewriteRule ^search(/|/page)?$ index.php?page=search RewriteRule ^business/(edit|view)/([a-z(-.*)]+)$ index.php?page=business&action=$1&url=$2 RewriteRule ^user/panel$ index.php?page=user&action=panel RewriteRule ^map/view/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)$ index.php?page=map&action=view&country=$1&state=$2&city=$3&borough=$4&kiosk=$5 RewriteRule ^map/view/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)$ index.php?page=map&action=view&country=$1&state=$2&city=$3&borough=$4 RewriteRule ^map/view/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)$ index.php?page=map&action=view&country=$1&state=$2&city=$3 RewriteRule ^map/view$ index.php?page=map&action=view RewriteRule ^map/post/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)$ index.php?page=map&action=post&country=$1&state=$2&city=$3 RewriteRule ^map/post$ index.php?page=map&action=post RewriteRule ^notice/remove/([0-9]+)/(.*)$ index.php?page=notice&action=remove&id=$1&key=$2 RewriteRule ^notice/edit/([0-9]+)/(.*)$ index.php?page=notice&action=edit&id=$1&key=$2 RewriteRule ^notice/view/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([0-9]+)$ index.php?page=notice&action=view&country=$1&state=$2&city=$3&borough=$4&kiosk=$5&id=$6 RewriteRule ^kiosk/(browse|view|post)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)$ index.php?page=kiosk&action=$1&country=$2&state=$3&city=$4&borough=$5&kiosk=$6 RewriteRule ^kiosk/post/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)/([a-z(-.*)]+)$ index.php?page=kiosk&action=post&country=$1&state=$2&city=$3&borough=$4&kiosk=$5 RewriteRule ^noticebag/(edit|remove)/([0-9]+)$ index.php?page=noticebag&action=$1&id=$2 RewriteRule ^noticebag/(view|checkout)$ index.php?page=noticebag&action=$1 RewriteRule ^noticebag$ index.php?page=noticebag&action=view RewriteRule ^([a-z_]+)$ index.php?page=$1 Code (markup): I suspect there's more that could be optimised especially if you knew how the PHP was written.
Once more I`ll write that : Many Thanks Tolra. You helped me a lot All is working fine now ( I made a mistake and put real site adr :/ could You edit it out ??)
Sorry it's not letting me edit the post, personally I wouldn't worry about it but if you're concerned you'll have to ask a mod to strip it. Glad it's working though.