I currently am working on a 3.0.2.0 OC site and having issues with the link URLs.
OS linux
1. Copied all ftp files from live site to local directory in apache root
2. downloaded backup of DB and created/imported it through localhost/phpmyadmin. Local site is up but config files point to live site.
3. Changed config files to hard coded directories for both public_html/config and admin/config.
4. Local Site working fine, but none of the links work and they 404 when I attempt them. Attempted to fix this with a new .htaccess file but had no luck.
'localhost/about-us' The requested URL /about-us was not found on this server.
Apache/2.4.18 (Ubuntu) Server at localhost Port 80
What can I do in order to fix this issue?
The references I used: http://forum.opencart.com/viewtopic.php?f=20&t=139100
Hi, and thanks for your response and it looks like you're right about it being a mod rewrite issue.
I've enabled rewrites in my /etc/apache2/sites-available/000-default.conf and enabled mod rewrite as listed in this guide
https://www.digitalocean.com/community/ ... untu-16-04
Step 3 of the guide is configuring the rewrites and I don't believe that it applies to my situation.
The site that I'm attempting to configure this for is a copy of a live opencart site that uses php and doesn't have an about.html and instead follows the catalog/views/theme/store/templates/common/.twig file structure.
I also have two .htaccess files. One in my root directory, and one in my public_html directory. They are both identical and go as follows.
Could you advise further on how I may be able to configure rewrites in this instance?
I've enabled rewrites in my /etc/apache2/sites-available/000-default.conf and enabled mod rewrite as listed in this guide
https://www.digitalocean.com/community/ ... untu-16-04
Step 3 of the guide is configuring the rewrites and I don't believe that it applies to my situation.
The site that I'm attempting to configure this for is a copy of a live opencart site that uses php and doesn't have an about.html and instead follows the catalog/views/theme/store/templates/common/.twig file structure.
I also have two .htaccess files. One in my root directory, and one in my public_html directory. They are both identical and go as follows.
Code: Select all
# 1.To use URL Alias you need to be running apache with mod_rewrite enabled.
# 2. In your opencart directory rename htaccess.txt to .htaccess.
# For any support issues please visit: http://www.opencart.com
Header set Content-Security-Policy: upgrade-insecure-requests
RewriteEngine On
RewriteCond %{HTTPS} off
[highlight]RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301][/highlight]
Options +FollowSymlinks
# Prevent Directoy listing
Options -Indexes
# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|.twig|\.ini|\.log|(?<!robots)\.txt))">
Require all denied
## For apache 2.2 and older, replace "Require all denied" with these two lines :
# Order deny,allow
# Deny from all
</FilesMatch>
# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
[highlight]RewriteBase /[/highlight]
RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##
### Additional Settings that may need to be enabled for some servers
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.
# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off
# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off
# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M
# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M
# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_execution_time 200
# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200
# 7. disable open_basedir limitations
# php_admin_value open_basedir none
To test mod_rewrite is working as expected, make sure you have the default OC Google Sitemaps feed enabled
Then visit localhost/sitemap.xml
If it shows the sitemap, mod_rewrite is working
With regards to .htaccess you only need one in the root of your store (where the main index.php file resides)
Actually, as you have access to the vhost conf files, I would put all the htaccess stuff in there and get rid of the htaccess altogether.
Then visit localhost/sitemap.xml
If it shows the sitemap, mod_rewrite is working
With regards to .htaccess you only need one in the root of your store (where the main index.php file resides)
Actually, as you have access to the vhost conf files, I would put all the htaccess stuff in there and get rid of the htaccess altogether.
Thanks UKsitebuilder,
This information has shown me that my mod rewrite isn't currently working, as I 404'd on the google site map. I'm currently trying to troubleshoot the issue. Is there any other steps that I may have missed besides enabling mod rewrite with a2enmod and allowing overrides in sites enabled/ sites available configs?
This information has shown me that my mod rewrite isn't currently working, as I 404'd on the google site map. I'm currently trying to troubleshoot the issue. Is there any other steps that I may have missed besides enabling mod rewrite with a2enmod and allowing overrides in sites enabled/ sites available configs?
Theonly thing I can see in your .htaccess is this line:
Is that actually how it reads in your .htaccess or is that 'highlight' bbcode added by the forum?
Also, your previous comment about having .htaccess in both your root director and public_html confused me a little. Is your site's root directory not one and the same as public_html
Code: Select all
[highlight]RewriteBase /[/highlight]
Also, your previous comment about having .htaccess in both your root director and public_html confused me a little. Is your site's root directory not one and the same as public_html
Hey again UKsitebuilder,
Those highlight tags are from the forum. I thought I was making it look pretty. As for the rewrite mod, I had a second apache conf that was superseding my global and wasn't configured for rewrites. Got that one working and was able to populate a sitemap.xml.
As for that comment, I believe I used the terminology wrong.
My site directory is one and the same as my public_html folder as it has my main index.php. However the directory above it that holds backups logs, mail, tmp and that sort had an htaccess document as well. I mistakenly referred to this directory as my site's root. Thanks for asking about that, and helping me clear that up.
As for the current state of the site, the the enabling of that htaccess file on localhost made it so I couldn't access the main page since it rewrote it to https through those first two rewrite conditions. I only have http: conventions configured for my localhost configs as defines for http and https servers.
I commented out those two lines and was able to get into the main site and see that sitemap.xml populated, but however the theme had gone back to opencart's test theme without any css apart from maybe two elements from my site's theme. Currently trying to figure out why that is, and will comment back when I know.
Those highlight tags are from the forum. I thought I was making it look pretty. As for the rewrite mod, I had a second apache conf that was superseding my global and wasn't configured for rewrites. Got that one working and was able to populate a sitemap.xml.
As for that comment, I believe I used the terminology wrong.
My site directory is one and the same as my public_html folder as it has my main index.php. However the directory above it that holds backups logs, mail, tmp and that sort had an htaccess document as well. I mistakenly referred to this directory as my site's root. Thanks for asking about that, and helping me clear that up.
As for the current state of the site, the the enabling of that htaccess file on localhost made it so I couldn't access the main page since it rewrote it to https through those first two rewrite conditions. I only have http: conventions configured for my localhost configs as defines for http and https servers.
I commented out those two lines and was able to get into the main site and see that sitemap.xml populated, but however the theme had gone back to opencart's test theme without any css apart from maybe two elements from my site's theme. Currently trying to figure out why that is, and will comment back when I know.
Did you guys got it working ?mmc013 wrote: ↑Thu Jan 25, 2018 5:14 amHey again UKsitebuilder,
Those highlight tags are from the forum. I thought I was making it look pretty. As for the rewrite mod, I had a second apache conf that was superseding my global and wasn't configured for rewrites. Got that one working and was able to populate a sitemap.xml.
As for that comment, I believe I used the terminology wrong.
My site directory is one and the same as my public_html folder as it has my main index.php. However the directory above it that holds backups logs, mail, tmp and that sort had an htaccess document as well. I mistakenly referred to this directory as my site's root. Thanks for asking about that, and helping me clear that up.
As for the current state of the site, the the enabling of that htaccess file on localhost made it so I couldn't access the main page since it rewrote it to https through those first two rewrite conditions. I only have http: conventions configured for my localhost configs as defines for http and https servers.
I commented out those two lines and was able to get into the main site and see that sitemap.xml populated, but however the theme had gone back to opencart's test theme without any css apart from maybe two elements from my site's theme. Currently trying to figure out why that is, and will comment back when I know.
Urgent Questions shoot here: khnaz35@gmail.com
Enjoy nature
Can you please share the working .htaccess for this issueuksitebuilder wrote: ↑Wed Jan 24, 2018 4:10 pmTheonly thing I can see in your .htaccess is this line:
Is that actually how it reads in your .htaccess or is that 'highlight' bbcode added by the forum?Code: Select all
[highlight]RewriteBase /[/highlight]
Also, your previous comment about having .htaccess in both your root director and public_html confused me a little. Is your site's root directory not one and the same as public_html
Urgent Questions shoot here: khnaz35@gmail.com
Enjoy nature
Who is online
Users browsing this forum: JNeuhoff and 236 guests