skip to Main Content

I have my .htaccess file working in localhost. But its not working if i upload it in server. It throws me 404 error.

I am using Parallel Plesk 11.0.9 and i can’t find conf file for the same on that. If anyone has any idea how to fix it or any workaround for url rewriting would be great help.

Anyway here’s the code in htaccess:

RewriteEngine on
RewriteRule ^store/living/Hutches-Armoires-Side-tables-Coffee-tables-Entertainment-centers? store.php?store=Living
RewriteRule ^store/dining/sideboards-buffets-chairs-benches-Dining-table$ store.php?store=Dining
RewriteRule ^store/working/Bookshelves-Study-tables$ store.php?store=Working
RewriteRule ^store/accessories/Boxes-Photo-Frames-Mirror-Frames-Block-Stamps-and-Book-stands$ store.php?store=Accessories
RewriteRule ^store/hallway/Console-tables-Armoires$ store.php?store=Hallway
RewriteRule ^store/sleeping/Bed-Frames-Night-Stands-Dressers-Mirror-framesBed-Linens-Canopies-Curtains$ store.php?store=Sleeping

2

Answers


  1. You may need to wrap your rewrite rules with:

    <IfModule mod_rewrite.c>
    ...
    </IfModule>
    

    …probably a good idea anyway.

    Or you could try putting your rules into a vhost.conf file in the conf directory immediately below the location of your httpdocs directory. For example on a Centos machine the web root might be

    /var/www/vhosts/domain.com/httpdocs
    

    and you should have a:

    /var/www/vhosts/domain.com/conf
    

    directory, this will contain a set of pregenerated Apache config files that Plesk creates. If there isn’t already create a vhost.conf and add your rules between a set of

    <Directory /var/www/vhosts/domain.com/httpdocs/ >
    
    ... your rules ...
    
    </Directory>
    

    Once you’ve created the vhost.conf file you will need to tell plesk about it with

    /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain domain.com
    

    If you still can’t get it to work you can add a log for mod_rewrite, see this relevant SO answer for details

    Login or Signup to reply.
  2. Is your Plesk running IIS and supporting PHP via FastCGI or ISAPI? If that is the case, check whether URL Rewrite is installed and follow this guide to translate htaccess (for apache) into web.config (for IIS)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search