Post by Pysiek » Sat Dec 20, 2014 8:37 am

I installed a custom theme on my opencart website. I sell single product and would like to redirect my customer to "product" page so when they type my web address it will take them straight there. How to do it in htaccess? Or maybe there is another way?

Active Member

Posts

Joined
Wed Dec 12, 2012 10:14 pm

Post by dabomb59404 » Sat Dec 20, 2014 5:26 pm

This should help you: http://www.htaccessredirect.co.uk

User avatar
Active Member

Posts

Joined
Thu Jun 09, 2011 5:21 am

Post by Pysiek » Sun Dec 21, 2014 3:34 am

I tried everything and nothing works. I want to redirect the web to product.php which is located in /catalog/controller/product/product.php
Anybody knows how to do it?

Opencart version 3.0.3.2


Active Member

Posts

Joined
Wed Dec 12, 2012 10:14 pm

Post by dabomb59404 » Sun Dec 21, 2014 3:43 am

You don't redirect to the product.php file. You redirect to the location you see in your browser address bar when you go to the page you want the redirection to go to. Go to the page you want the redirection to go to and look at the URL that page is at. That is the location to redirect to.

User avatar
Active Member

Posts

Joined
Thu Jun 09, 2011 5:21 am

Post by Pysiek » Tue Dec 23, 2014 1:27 am

Still can't figure it out :(

Opencart version 3.0.3.2


Active Member

Posts

Joined
Wed Dec 12, 2012 10:14 pm

Post by dabomb59404 » Tue Dec 23, 2014 6:31 am

Make sure you have Use SEO URLs set to Yes in your admin Settings under the Server tab. Make sure you have a SEO Keyword for your category and product.

Add this below to the bottom of your .htaccess file:
RewriteCond %{HTTP_HOST} ^(www\.)?yoursite\.com [NC]
RewriteRule ^/?$ http://yoursite.com/categoryname/productname [L,R=301]

Change the yoursite.com in both places to the URL of your site. Change the categoryname to the name of the category your product is in and the productname to the name of your product. You can also leave out the categoryname and just have the productname if you like. Now when anyone goes to your site root they will be directed to the page for your product.

User avatar
Active Member

Posts

Joined
Thu Jun 09, 2011 5:21 am

Post by Pysiek » Tue Dec 23, 2014 9:49 pm

I did everything like you told me to do and it still take me to the main webpage as always. And now when I click on the category tab it says "Not found". It looks like it was trying to find the SEO keywords.

Opencart version 3.0.3.2


Active Member

Posts

Joined
Wed Dec 12, 2012 10:14 pm

Post by dabomb59404 » Wed Dec 24, 2014 12:06 am

You must be doing something wrong then because I tested it and it works. Do you have the default unedited .htaccess file that comes with OC and do you have mod_rewrite installed on your server? What is the URL to your product?

User avatar
Active Member

Posts

Joined
Thu Jun 09, 2011 5:21 am

Post by Pysiek » Wed Dec 24, 2014 12:27 am

To answer your questions. According to godaddy my linux server comes with mod_rewrite already installed. URL to my product is: http://bow-rod.com/index.php?route=prod ... duct_id=50

Opencart version 3.0.3.2


Active Member

Posts

Joined
Wed Dec 12, 2012 10:14 pm

Post by dabomb59404 » Wed Dec 24, 2014 12:50 am

That is not an SEO link to your product so your SEO URL's are not working. You need to have Use SEO URLs set to Yes and you need to have a SEO Keyword set for your product. You also need to have the .htaccess file renamed from .htaccess.txt to .htaccess. When you have the SEO URL's working then the addition I showed you for the .htaccess file will work.

User avatar
Active Member

Posts

Joined
Thu Jun 09, 2011 5:21 am

Post by Pysiek » Wed Dec 24, 2014 12:58 am

Okay. I enabled SEO links. Added SEO keywords to "Category" and "Product".
Added this to my .htaccess and rename it from .htaccess.txt to .htaccess
"RewriteCond %{HTTP_HOST} ^(www\.)?mywebsite\.com [NC]
RewriteRule ^/?$ http://mywebsite.com/bowrod system/bowrod [L,R=301]"
I replaced the mywebsite.com with my web address
Now when I go to the link bow-rod.com it says:
"Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator and inform them of the time the error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.
Apache Server at bow-rod.com Port 80"

Opencart version 3.0.3.2


Active Member

Posts

Joined
Wed Dec 12, 2012 10:14 pm

Post by Pysiek » Wed Dec 24, 2014 1:00 am

Also when I type my web address it does take me to : "http://myweb.com/bowrod-system/bowrod" link but it says:
"Not Found

The requested URL /bowrod/bowrod-system/bowrod was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache Server at bow-rod.com Port 80"

Opencart version 3.0.3.2


Active Member

Posts

Joined
Wed Dec 12, 2012 10:14 pm

Post by dabomb59404 » Wed Dec 24, 2014 1:14 am

Your SEO URLs are not working. Did you rename the .htaccess.txt file to .htaccess and is it the default one that comes with OC?

User avatar
Active Member

Posts

Joined
Thu Jun 09, 2011 5:21 am

Post by Pysiek » Wed Dec 24, 2014 1:16 am

I did rename it. Is it default one? I don't know. I have installed a custom theme. Maybe it did change something.

Opencart version 3.0.3.2


Active Member

Posts

Joined
Wed Dec 12, 2012 10:14 pm

Post by dabomb59404 » Wed Dec 24, 2014 1:20 am

What do you have for the base in it? You should have this:
RewriteBase /

User avatar
Active Member

Posts

Joined
Thu Jun 09, 2011 5:21 am

Post by Pysiek » Wed Dec 24, 2014 1:25 am

Here is my .htaccess file :

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.comOptions +FollowSymlinks# Prevent Directoy listing Options -Indexes# Prevent Direct Access to files<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))"> Order deny,allow Deny from all</FilesMatch># SEO URL SettingsRewriteEngine On# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/ RewriteBase /RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]RewriteRule ^download/(.*) /index.php?route=error/not_found [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]### 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
RewriteCond %{HTTP_HOST} ^(www\.)?bow-rod\.com [NC]
RewriteRule ^/?$ http://bow-rod.com/bowrod-system/bowrod [L,R=301]

Opencart version 3.0.3.2


Active Member

Posts

Joined
Wed Dec 12, 2012 10:14 pm

Post by dabomb59404 » Wed Dec 24, 2014 1:35 am

Is all the code in the .htaccess file on one line like you show there? It should look like this:

# 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

Options +FollowSymlinks

# Prevent Directoy listing
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
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/

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /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]

User avatar
Active Member

Posts

Joined
Thu Jun 09, 2011 5:21 am

Post by Pysiek » Wed Dec 24, 2014 1:38 am

This is all. This file came with the custom theme I bought. I still have the original file from Opencart 2.0. Should I replace them? Basically this is the same file

Opencart version 3.0.3.2


Active Member

Posts

Joined
Wed Dec 12, 2012 10:14 pm

Post by dabomb59404 » Wed Dec 24, 2014 1:47 am

Yes use the one that comes with OC.
Also do you have your site in the main web folder or do you have it in a named folder in the main web folder?
It looks like you have it in a folder named bowrod and if that is the case then change this in the .htaccess file:
RewriteBase /

To this:
RewriteBase /bowrod/

User avatar
Active Member

Posts

Joined
Thu Jun 09, 2011 5:21 am

Post by Pysiek » Wed Dec 24, 2014 1:58 am

Yes. It is in subfolder "bowrod" in root folder of my server.

Opencart version 3.0.3.2


Active Member

Posts

Joined
Wed Dec 12, 2012 10:14 pm
Who is online

Users browsing this forum: No registered users and 12 guests