RewriteEngine on

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1%{REQUEST_URI} [R=301,QSA,NC,L]

RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L]

##Remove multiple slashes in url
RewriteCond %{HTTP_HOST} !=""
RewriteCond %{THE_REQUEST} ^[A-Z]+\s//+(.*)\sHTTP/[0-9.]+$ [OR]
RewriteCond %{THE_REQUEST} ^[A-Z]+\s(.*/)/+\sHTTP/[0-9.]+$
RewriteRule .* https://%{HTTP_HOST}/%1 [R=301,L]

# RewriteRule ^(.*)$ $1.php [L,QSA]

RewriteRule ^rewards.html$ "rewards" [l]

RewriteRule ^posts$ "posts.php" [L]
RewriteRule ^posts/more/([^/]+)$ "posts.php?name=more&more=$1" [L]
RewriteRule ^posts/search/([^/]+)$ "posts.php?name=search&term=$1" [L]
RewriteRule ^posts/search/([^/]+)/([^/]+)$ "posts.php?name=search&term=$1&more=$2" [L]
RewriteRule ^posts/(.*)$ "posts.php?name=$1" [L]

RewriteRule ^admin/help$ "admin/help.php" [L]
RewriteRule ^admin/help/(.*)$ "admin/help.php?page=$1" [L]

RewriteRule ^recalls$ "sg.php?page=recalls" [L]
RewriteRule ^exclusive-brands$ "sg.php?page=exclusive-brands" [L]
RewriteRule ^sg/exclusive-brands$ http://%{HTTP_HOST}/exclusive-brands [NC,QSA,R=302,L]

RewriteRule ^sg/(.*)$ "sg.php?page=$1" [L]
#Hook for adding global redirects
RewriteRule ^FCFridays$ "sg.php?page=food-club-fridays" [L,NC]
RewriteRule ^food-club$ "sg.php?page=food-club" [L]

RewriteRule ^hotDeals$ "hotDeals.php" [L]
RewriteRule ^coupons$ "coupons.php" [L]
RewriteRule ^aboutUs$ "aboutUs.php" [L]
RewriteRule ^user-update$ "register.php?update=true" [L]

RewriteRule ^departments$ "departments.php" [L]
RewriteRule ^departments/(.*)$ "departments.php?dep=$1" [L]

RewriteRule ^recipes$ "recipes.php" [L]
RewriteRule ^recipes/(.*)$ "recipes.php?id=$1" [L]

RewriteRule ^rewards$ "rewards.php" [L]
RewriteRule ^rewards/(.*)$ "rewards.php?page=$1" [L]

RewriteRule ^promotions/(.*)$ "promotions.php?id=$1" [L]

RewriteRule ^produceGlossary$ "produceGlossary.php" [L]

RewriteRule ^shoppingList$ "shoppingList.php" [L]
RewriteRule ^shoppingList/list/([^/]+)$ "shoppingList.php?a=list&list=$1" [L]
RewriteRule ^shoppingList/view/([^/]+)$ "shoppingList.php?a=view&list=$1" [L]
RewriteRule ^shoppingList/(.*)$ "shoppingList.php?a=$1" [L]

RewriteRule ^win-a-cruise$ "win-a-cruise.php" [L]

RewriteRule ^weeklyAd$ "weeklyAd.php" [L]
RewriteRule ^contactUs$ "contactUs.php" [L]
RewriteRule ^lunchSpecials$ "lunchSpecials.php" [L]
RewriteRule ^hotDeals$ "hotDeals.php" [L]
RewriteRule ^employment$ "employment.php" [L]
RewriteRule ^community$ "community.php" [L]
RewriteRule ^email$ "email.php" [L]
RewriteRule ^fuel-savings$ "fuel-savings.php" [L]
RewriteRule ^our-team$ "our-team.php" [L]
RewriteRule ^about-us$ "about-us.php" [L]
RewriteRule ^links$ "links.php" [L]
RewriteRule ^special-order$ "contactUs.php?a=special" [L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^([^/]*)$ "index.php?loc=$1" [L]

<Files 403.shtml>
order allow,deny
allow from all
</Files>

deny from 216.224.173.163
deny from 213.238.175.29
deny from 64.187.235.11
deny from 52.4.213.83
deny from 54.242.27.1
