festival Posted June 27, 2010 Share Posted June 27, 2010 I've read around the forums quite a bit about the issue, and I know mod rewrite is enabled on my server, and I've generated an .htaccess file... but something is still wrong.All of the product images will be missing and when I view the product, it says the page cannot be found.My .htaccess file looks like this: # Catch 404 errors ErrorDocument 404 /404.php Which seems oddly short... Link to comment Share on other sites More sharing options...
rocky Posted June 28, 2010 Share Posted June 28, 2010 That file is missing all the friendly URL code. It has the 404 redirect code only. Try going to the Preferences tab and making sure that "Friendly URL" is "Yes", then go to Tools > Generators and click "Generate .htaccess file". You should get a file similar to the following: # .htaccess automaticaly generated by PrestaShop e-commerce open-source solution # http://www.prestashop.com - http://www.prestashop.com/forums # 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$ /img/p/$1-$2$3.jpg [L,E] RewriteRule ^([0-9]+)\-([0-9]+)/([_a-zA-Z0-9-]*)\.jpg$ /img/p/$1-$2.jpg [L,E] RewriteRule ^([0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /img/c/$1$2.jpg [L,E] RewriteRule ^lang-([a-z]{2})/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$3&isolang;=$1$5 [L,E] RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2&isolang;=$1$4 [L,E] RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$2&isolang;=$1 [QSA,L,E] RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2$4 [L,E] RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$1$3 [L,E] RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$1 [QSA,L,E] RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /cms.php?id_cms=$1 [QSA,L,E] RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ /supplier.php?id_supplier=$1$3 [QSA,L,E] RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ /manufacturer.php?id_manufacturer=$1$3 [QSA,L,E] RewriteRule ^lang-([a-z]{2})/(.*)$ /$2?isolang=$1 [QSA,L,E] # Catch 404 errors ErrorDocument 404 /404.php Link to comment Share on other sites More sharing options...
festival Posted June 28, 2010 Author Share Posted June 28, 2010 Oh, thank you so much. I guess I was generating the file, and then turning on friendly urls. Link to comment Share on other sites More sharing options...
Rockstar2 Posted June 28, 2010 Share Posted June 28, 2010 Thanks too! Link to comment Share on other sites More sharing options...
OsoPeludo Posted June 29, 2010 Share Posted June 29, 2010 Am I being incredibly thick about this? In my I go prestashop tools generate and I see:Warning: this tool can ONLY be used if you are hosted by an Apache web server. Please ask your webhost.This tool will automatically generate a ".htaccess" file that will grant you the possibility to do URL rewriting and to catch 404 errors.If you do not have the "Friendly URL" enabled when generating the ".htaccess" file, such feature won't be available.Before being able to use this tool, you need to:- create a .htaccess blank file in dir: /- give it write permissions (CHMOD 666 on Unix system)In the demo of prestashop I see:Warning: this tool can ONLY be used if you are hosted by an Apache web server. Please ask your webhost.This tool will automatically generate a ".htaccess" file that will grant you the possibility to do URL rewriting and to catch 404 errors.If you do not have the "Friendly URL" enabled when generating the ".htaccess" file, such feature won't be available.Generate your ".htaccess" file by clicking on the following button:This will erase your old .htaccess file!(ie with a button to generate the htaccess file). Where am I going wrong? Thanks. Link to comment Share on other sites More sharing options...
rocky Posted June 29, 2010 Share Posted June 29, 2010 Have you uploaded a blank file called .htaccess to the root of your PrestaShop directory and given it chmod 666 permissions? Link to comment Share on other sites More sharing options...
OsoPeludo Posted June 29, 2010 Share Posted June 29, 2010 yes. the problem is that there is no generate htaccess file button (or robot come to that!). I am using firefox but have also tried in ie7 Link to comment Share on other sites More sharing options...
OsoPeludo Posted June 29, 2010 Share Posted June 29, 2010 fixed. made file htaccess should have been .htaccess. thanks for help. stupid of me. Link to comment Share on other sites More sharing options...
OsoPeludo Posted June 29, 2010 Share Posted June 29, 2010 a heart-stopping moment when no products would show but I repeated process as per your mail 28 june and everything is working perfectly. thanks for your advice. d. Link to comment Share on other sites More sharing options...
WODP Posted June 30, 2010 Share Posted June 30, 2010 Hello.What about redirect from non www to www urls?Is it enough to add: RewriteCond %{HTTP_HOST} ^example.com RewriteRule (.*) http://www.example.com/$1 [R=301,L] ... to existing prestashop htaccess generated file?Friendly url's are ONRewriteEngine ONand in httpd.conf file uncommented: LoadModule rewrite_module modules/mod_rewrite.so Or is there another (better) way?Thanks, W. Link to comment Share on other sites More sharing options...
rocky Posted June 30, 2010 Share Posted June 30, 2010 Yes, that's the way I'm doing it on my website. Just copy it into the .htaccess file generated by PrestaShop. Link to comment Share on other sites More sharing options...
WODP Posted June 30, 2010 Share Posted June 30, 2010 Thanks, i've tried it and works great.Maybe this can be included in PS by default, it's good function Link to comment Share on other sites More sharing options...
sh0p Posted August 18, 2010 Share Posted August 18, 2010 Hello,I have a simillar problem. Whenever I enable the Friendly URL and generate the .htaccess file from the Back Office, the friendly url works in my website, but bugs the Back Office. I cannot access the Back Office when the Rewrite Engine is on. As long as I turn the Rewrite Engine OFF in the htaccess file, and the Friendly URL enabled – the website gives me the following error:‘ Error We’re sorry, but the Web address you entered is no longer available ‘I am using prestashop 1.3.1How to make both the website and the BO work when htaccess is ON and Friendly URL enabled?Can someone help me out? Thanks in advance.Regards. Link to comment Share on other sites More sharing options...
airsoft4you Posted August 22, 2010 Share Posted August 22, 2010 i have done all of the above advice and i still cant seem to get it working,im not sure if my server is in the correct mode, does the mod rewrite make any difference how can you tell if this is enabled, i am using fasthosts as a hosting company.Toby Link to comment Share on other sites More sharing options...
lehai Posted March 17, 2011 Share Posted March 17, 2011 Thank rocky so much :-) Link to comment Share on other sites More sharing options...
willem1981 Posted April 1, 2011 Share Posted April 1, 2011 When i set Friendly urls on in theback-office then my front-office isnt working correctly.The customer login doesnt work any more.What could it be? I have the .htaccess genererated by prestashop and added. # URL rewriting module activation RewriteEngine on RewriteCond %{REQUEST_METHOD} !^(TRACE|TRACK|GET|POST|HEAD)$ RewriteRule .* - [F] RewriteBase / Options +FollowSymLinks # URL rewriting rules RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)-([a-zA-Z0-9-]*).html(.*)$ product.php?id_product=$2$4 [L,E] RewriteRule ^([0-9]+)-([a-zA-Z0-9-]*).html(.*)$ product.php?id_product=$1$3 [L,E] RewriteRule ^([0-9]+)-([a-zA-Z0-9-]*)(.*)$ category.php?id_category=$1 [QSA,L,E] RewriteRule ^content/([0-9]+)-([a-zA-Z0-9-]*)(.*)$ cms.php?id_cms=$1 [QSA,L,E] RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ supplier.php?id_supplier=$1$3 [QSA,L,E] RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ manufacturer.php?id_manufacturer=$1$3 [QSA,L,E] # Catch 404 errors ErrorDocument 404 /404.php Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now