Jump to content

Zeus Web Server .htaccess conversion


jon_thompson

Recommended Posts

I've noticed requests to convert the default .htaccess file generated by Prestashop to nginx and lighttpd in forum/google searches, so I thought I'd add this one.

 

For anyone that is running their website on a server using Zeus Web Server, this is what they need to use

 

map path into SCRATCH:path from %{URL}
look for file at %{SCRATCH:path}
if exists then goto END
look for dir at %{SCRATCH:path}
if exists then goto END

match URL into $ with ^/(page-not-found)$
if matched then
set URL=/404.php
goto END
endif

match URL into $ with ^/(guest-tracking|discount|contact-us|cart|best-sales|authentication|addresses|my-account|manufacturers|identity|order-history)(\?.*)?$
if matched then
set URL=/$1.php$2
goto END
endif

match URL into $ with ^/(supplier|stores|sitemap|search|prices-drop|password-recovery|order-slip|quick-order|order-follow|order|new-products)(\?.*)?$
if matched then
set URL=/$1.php$2
goto END
endif

match URL into $ with ^/([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$
if matched then
set URL=/img/p/$1-$2$3.jpg
goto END
endif

match URL into $ with ^/([0-9]+)\-([0-9]+)/[_a-zA-Z0-9-]*\.jpg$
if matched then
set URL=/img/p/$1-$2.jpg
goto END
endif


match URL into $ with ^/([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$
if matched then
set URL=/img/p/$1/$1$2.jpg
goto END
endif


match URL into $ with ^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$
if matched then
set URL=/img/p/$1/$2/$1$2$3.jpg
goto END
endif


match URL into $ with ^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$
if matched then
set URL=/img/p/$1/$2/$3/$1$2$3$4.jpg
goto END
endif


match URL into $ with ^/([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$
if matched then
set URL=/img/p/$1/$2/$3/$4/$1$2$3$4$5.jpg
goto END
endif


match URL into $ with ^/([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$
if matched then
set URL=/img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6.jpg
goto END
endif


match URL into $ with ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$
if matched then
set URL=/img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7.jpg
goto END
endif


match URL into $ with ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$
if matched then
set URL=/img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8.jpg
goto END
endif


match URL into $ with ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$
if matched then
set URL=/img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg
goto END
endif


match URL into $ with ^/c/([0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$
if matched then
set URL=/img/c/$1$2.jpg
goto END
endif


match URL into $ with ^/c/([a-zA-Z-]+)/[a-zA-Z0-9-]+\.jpg$
if matched then
set URL=/img/c/$1.jpg
goto END
endif


match URL into $ with ^/([0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$
if matched then
set URL=/img/c/$1$2.jpg
goto END
endif


match URL into $ with ^/([0-9]+)\-[a-zA-Z0-9-]*\.html
if matched then
set URL=/product.php?id_product=$1
goto END
endif


match URL into $ with ^/[a-zA-Z0-9-]*/([0-9]+)\-[a-zA-Z0-9-]*\.html
if matched then
set URL=/product.php?id_product=$1
goto END
endif


match URL into $ with ^/([0-9]+)\-[a-zA-Z0-9-]*(/[a-zA-Z0-9-]*)+
if matched then
set URL=/category.php?id_category=$1&noredirect=1
goto END
endif


match URL into $ with ^/([0-9]+)\-[a-zA-Z0-9-]*
if matched then
set URL=/category.php?id_category=$1
goto END
endif


match URL into $ with ^/([0-9]+)__([a-zA-Z0-9-]*)
if matched then
set URL=/supplier.php?id_supplier=$1
goto END
endif


match URL into $ with ^/([0-9]+)_([a-zA-Z0-9-]*)
if matched then
set URL=/manufacturer.php?id_manufacturer=$1
goto END
endif


match URL into $ with ^/content/([0-9]+)\-([a-zA-Z0-9-]*)
if matched then
set URL=/cms.php?id_cms=$1
goto END
endif


match URL into $ with ^/content/category/([0-9]+)\-([a-zA-Z0-9-]*)
if matched then
set URL=/cms.php?id_cms_category=$1
goto END
endif

 

The hosting company I use/work for (Namesco/Register365) require these rules to be placed in a text file called rewrite.script and uploaded to the web root of your site (where all the files in a browser are served from) - other comapnies that use ZWS may have different configurations/requirement, so check with your web host.

 

Once it's in place, SEO options and short URLs should now work in Prestashop.

 

NB - this code assumes that your shop is available in the web root of your site. If it's in a sub-folder (eg /shop) then you need to change all the lines to reflect this

 

Example:

 

match URL into $ with ^/shop/([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$
if matched then
set URL=/shop/img/p/$1-$2$3.jpg
goto END
endif

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
  • 7 months later...
  • 2 weeks later...

Need a little help!...i`m a prestashop newbie in the process of building my own web-store for my business. My site is pretty much done and everything is working fine apart from URL rewriting.

 

I am with Register 365 shared hosting and they run on Zeus. I have requested that they set the fopen function in the php and they have done this, so I then used the above code and stored a rewtite.script in my web root, but this has no effect. When I test it by refreshing my browser the URL changes and my webpage disappears "Oops! This link appears to be broken".

 

What the hell am I doing wrong i`ve tried everything i`ve found on forums (as i`m not a coder) but cannot seem to get it to work. I need my site live this week and I will put it live with or without friendly URL rewriting capability but I know it will be a disaster for SEO, so if anybody can help out it would be much appreciated!

Link to comment
Share on other sites

Hi Joel, I am using 1.4.7.0. I have my root (web) folder, then there are prestashop files within that folder including the prestashop folder, then the theme is within that ( but I presume the theme doesnt really play a part in this problem). I installed the software through a one-click install provided by my host through Softaculous and this is the way it installed. When I go to my domain eg. brianshop.com my shop comes up so it must be in the root?

Link to comment
Share on other sites

  • 5 months later...

I seem to have the same problem - followed your instructions and still it's not recognized by prestashop 1.5.4.1

Im with Namesco Ireland

 

"URL rewriting (mod_rewrite) is not active on your server, or it is not possible to check your server configuration. If you want to use Friendly URLs, you must activate this mod."

 

Any ideas?

Link to comment
Share on other sites

  • 1 year later...

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