Jump to content

Editing .htaccess file?


Recommended Posts

Hello there,
I am hosting my site with hostmonster.Previously my site had a problem of displaying my main homepage on http://www.electronicsforeal.com/prestashop.'>http://www.electronicsforeal.com/prestashop. As for the main page http://www.electronicsforeal.com would be displaying the test prestashop page with dummy characters.I contacted hostmonster and they helped me solve this by editing public_html/.htaccess file so as to redirect the contents of http://www.electronicsforeal.com/prestashop to http://www.electronicsforeal.com so that both of the urls are pointing to the same main page.

the code i used was

# Use PHP5 Single php.ini as default
AddHandler application/x-httpd-php5s .php
# Hostmonster.com
# .htaccess main domain to subdirectory redirect
# Copy and paste the following code into the .htaccess file
# in the public_html folder of your hosting account
# make the changes to the file according to the instructions.
# Do not change this line.
RewriteEngine on
# Change electronicsforeal.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?electronicsforeal.com$
# Change 'prestashop' to be the directory you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/prestashop/
# Don't change this line.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'prestashop' to be the directory you will use for your main domain.
RewriteRule ^(.*)$ /prestashop/$1
# Change electronicsforeal.com to be your main domain again.
# Change 'prestashop' to be the directory you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?electronicsforeal.com$
RewriteRule ^(/)?$ prestashop/index.php [L]



and redirection was successful.
Now the problem arose again after i enabled friendly url and generated .htaccess file by creating /prestashop/.htaccess

the old .htaccess file above had been replaced by this here

# URL rewriting module activation

RewriteEngine on

# URL rewriting rules

RewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /prestashop/img/p/$1-$2$3.jpg [L,E]
RewriteRule ^([0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /prestashop/img/c/$1$2.jpg [L,E]
RewriteRule ^lang-([a-z]{2})/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /prestashop/product.php?id_product=$3&isolang;=$1$5 [L,E]
RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /prestashop/product.php?id_product=$2&isolang;=$1$4 [L,E]
RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /prestashop/category.php?id_category=$2&isolang;=$1 [QSA,L,E]
RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /prestashop/product.php?id_product=$2$4 [L,E]
RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /prestashop/product.php?id_product=$1$3 [L,E]
RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /prestashop/category.php?id_category=$1 [QSA,L,E]
RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /prestashop/cms.php?id_cms=$1 [QSA,L,E]
RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ /prestashop/supplier.php?id_supplier=$1$3 [QSA,L,E]
RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ /prestashop/manufacturer.php?id_manufacturer=$1$3 [QSA,L,E]


And the previous problem of two different pages for http://www.electronicsforeal.com/prestashop and http://www.electronicsforeal.com is here again.

Could somebody help me how i can manipulate the new .htaccess code to get http://www.electronicsforeal.com/prestashop point to my domain name http://www.electronicsforeal.com?

I have tried to add the old .htaccess code to the new one generated after generating .htaccess but didn’t work.

Thanks and very sorry for the long explanation and code

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...