Jump to content

Help with .htaccess redirect


Recommended Posts

Our current website is an X-cart install located on our webhosting server at: http://www.domain.com/store/

 

We have Bluehost and in the CP, I set up a redirect for the primary domain. This CP feature automatically writes code to the .htaccess file. So when someone types:

 

www.domain.com

 

they are redirected immediately to

 

www.domain.com/store/

 

I'd like to develop Prestashop at the webroot level and install it there, but then of course, if I try to access it, I will get kicked to our current shop.

 

How do I add an exception to my .htaccess file for my IP address, so I don't get kicked over like everyone else? That way I can develop my Prestashop at the webroot level. I'm not sure this is the best way to develop a Prestashop store, but I'm a newb and it would be nice if when people went to our new Prestashop store the home page was at webroot level rather than a folder.

 

Here is what current .htaccess looks like:

 

# Use PHP5 as default
AddHandler application/x-httpd-php5 .php

RewriteEngine on

# Clean URLs [[[
# For security reasons, Option followsymlinks cannot be overridden.
#Options +FollowSymLinks -MultiViews -Indexes
Options +SymLinksIfOwnerMatch -MultiViews -Indexes
<IfModule mod_rewrite.c>
RewriteBase /store/
RewriteCond %{REQUEST_URI} !^/store/(payment|admin|provider|partner)/
RewriteCond %{REQUEST_FILENAME} !\.(gif|jpe?g|png|js|css|swf|php|ico)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ dispatcher.php [L]
</IfModule>
# /Clean URLs ]]]

AuthName "/store"
AuthUserFile "/home8/domaincom/.htpasswds/public_html/passwd"

RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^/?$ "http\:\/\/www\.domain\.com\/store" [R=301,L]

 

 

Looking around the net, I'm confused on all the different ways to use .htaccess files, but I was thinking of adding something like this, but I do not know if it's correct. where 1.x.x.x would be my IP address so I don't get redirected. But then do I need to comment out any lines above?

 

RewriteCond %{REMOTE_ADDR} !=1.3.3.7
RewriteCond %{REQUEST_URI} !=/store/index.php
RewriteRule .* /store/index.php [L]

Edited by waterworks2 (see edit history)
Link to comment
Share on other sites

Hi waterworks2,

You can add the following to your .htaccess file (but replacing 123.45.67.89 with your IP address):

RewriteCond %{REMOTE_HOST} !^123\.45\.67\.89

 

Although I'd personally recommend creating another hosting account, and then modifying the hosts file on your computer to fool DNS to point you to the new site. That way you won't have your X-cart files interfering at all. If you'd like I could talk to my host (imshophosting.com, who specialises in PrestaShop hosting) to see if they could let you use a free account for the first month.

 

Cheers,

Mark

Edited by markroach (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...