3

Im trying enable seo_url in Opencart 2.3 on lockalhost(with Docker), but url's give me 404 error. .htaccess renamed, cache clear.

How it works on docker ?

THANKS !

focus.style
  • 6,612
  • 4
  • 26
  • 38

1 Answers1

1
  1. Firs of all - take default .htaccess.txt file form your versions OpenCart pakage. If you made some changes in your .htaccess - it is better to take the original one. In other case - skip this step.

  2. You have to rename .htaccess.txt into .htaccess. It's not so obvious on Windows. Open it with notepad and then Save As the file, renaming it to .htaccess without .txt. Hope, you done this already, but for everyone else who will read this - make sure you have done it.

  3. If your are using inner folder for your OpenCart site, and the address is like http://localhost/inner_folder/ - your rewrite base in .htaccess should be RewriteBase /inner_folder/. If the OC folder is domain root - rewrite base is RewriteBase /

  4. Although, make sure that you are using Apache web server with modrewrite. Go to php error log - maybe you will find there some info.

  5. Make sure the Use SEO URLs is Yes in System> Settings > your store > Server.

  6. There is SEO URL field in every category, product, manufacturer. You should fill SEO URL field of each of them to SEO URL works correct. In SEO URL you should use only Latin symbols, digits, minus(-) and underscore (_). No spaces or other special characters.

UPDATED

If apache doesn't see .htaccess file - you should go to apache .conf file (/httpd/httpd.conf for Docker) and add after VirtualHost block

<Directory /var/www/html/your_folder/>
    Options Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

Directory - is a path from Docker root. Restart apache. Should work.

focus.style
  • 6,612
  • 4
  • 26
  • 38
  • Thanks for the answer! Directory without inner folders. All requirements done. But still not work.. – Robert Cody May 15 '20 at 11:03
  • If it will help you to solve a problem - you can mark it as accepted. Any additional questions you can ask here, in comments. Will try to help you as I can. – focus.style May 15 '20 at 11:06
  • Lets check if rewrite_mode is enabled? https://stackoverflow.com/questions/37063573/apache-docker-container-invalid-command-rewriteengine/38064289 – focus.style May 15 '20 at 11:33
  • And test, if htaccess works https://stackoverflow.com/questions/9234289/how-to-debug-htaccess-rewriterule-not-working – focus.style May 15 '20 at 11:41
  • I checked everything. I gues, Apache doesn't seem to find htaccess at all – Robert Cody May 15 '20 at 12:34
  • Updated an answer. – focus.style May 15 '20 at 13:04
  • 1
    Yes, I did the same and it works! I uploaded the file from the container to the local host and edited it docker cp :/etc/apache2/ . then upload my apache.conf to container and restart it docker cp apache2.conf :/etc/apache2/ Thanks for Help ! – Robert Cody May 15 '20 at 13:27