Post by gurjyot » Sat Jun 27, 2015 8:02 pm

I have installed opencart the way it is said in documentation. But after that if I open my website domain.com, then it is opening www.domain.com/domain.com
But if I open www.domain.com then actual store opens. Can some tell me what is going wrong with simple domain.com
I have even tried 301 redirect by using this code

Code: Select all

redirect 301 /Old_Resource http://www.mydomain.co.uk/index.php?route=product/category&path=37
RewriteCond %{QUERY_STRING} ^route=product/category&path=37$
RewriteRule ^index\.php$ http://www.mydomain.co.uk/new-resource? [R=301,L]

I got this code from viewtopic.php?t=21971

Can someone tell my why I am always redirected to www.domain.com/domain.com instead of www.domain.com

I am using Hostgator Share account for hosting purpose.

Newbie

Posts

Joined
Fri Jun 26, 2015 4:40 am

Post by deepvision » Sat Jun 27, 2015 8:44 pm

There must be something else in the .htaccess trying to redirect to www., but doing it wrong

ImageImageImage


User avatar
Active Member

Posts

Joined
Tue May 19, 2015 1:03 am

Post by gurjyot » Sun Jun 28, 2015 4:48 am

deepvision wrote:There must be something else in the .htaccess trying to redirect to http://www., but doing it wrong
Initially I hadn't touched anything, just a simple and clean installation. But as this problem arose then I tried for 301 redirect. Since only www.domain.com is showing the real store so I tried to redirect the domain to there. But that didn't came handy and the problem still existed. Can you suggest me something that I should try?

Newbie

Posts

Joined
Fri Jun 26, 2015 4:40 am

Post by deepvision » Sun Jun 28, 2015 4:59 am

May I see the .htaccess file?
So when you open your site domain.com in a browser you get redirected to www.domain.com/domain.com instantly?
Last edited by deepvision on Sun Jun 28, 2015 5:07 am, edited 1 time in total.

ImageImageImage


User avatar
Active Member

Posts

Joined
Tue May 19, 2015 1:03 am

Post by gurjyot » Sun Jun 28, 2015 5:04 am

deepvision wrote:May I see the .htaccess file?
Thanks for giving me your valuable time. Here is how the .htaccess file looks for my website.

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

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
redirect 301 /Old_Resource http://www.domain.com/index.php?route=product/category&path=37
RewriteCond %{QUERY_STRING} ^route=product/category&path=37$
RewriteRule ^index\.php$ http://www.domain.com/new-resource? [R=301,L]
# 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 ^system/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]

### 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
After RewriteEngine on I have added 3 lines of code for 301 redirect but that didn't worked.

Newbie

Posts

Joined
Fri Jun 26, 2015 4:40 am

Post by deepvision » Sun Jun 28, 2015 5:08 am

I am not sure if it is it, but

Code: Select all

RewriteCond %{QUERY_STRING} ^route=product/category&path=37$
RewriteRule ^index\.php$ http://www.domain.com/new-resource? [R=301,L
should not appear before

Code: Select all

RewriteBase /

ImageImageImage


User avatar
Active Member

Posts

Joined
Tue May 19, 2015 1:03 am

Post by deepvision » Sun Jun 28, 2015 5:12 am

And this code looks very weird. You never wrote what you tried to achieve with this.

Code: Select all

redirect 301 /Old_Resource http://www.domain.com/index.php?route=product/category&path=37
RewriteCond %{QUERY_STRING} ^route=product/category&path=37$
RewriteRule ^index\.php$ http://www.domain.com/new-resource? [R=301,L]

ImageImageImage


User avatar
Active Member

Posts

Joined
Tue May 19, 2015 1:03 am

Post by gurjyot » Sun Jun 28, 2015 5:15 am

deepvision wrote:I am not sure if it is it, but

Code: Select all

RewriteCond %{QUERY_STRING} ^route=product/category&path=37$
RewriteRule ^index\.php$ http://www.domain.com/new-resource? [R=301,L
should not appear before

Code: Select all

RewriteBase /
If those lines of code shouldn't be there then where should I place them.
To be more clear on the topic, this is what I am getting when I type domain.com and gets redirected to http://www.domain.com/domain.com

Internal Server Error

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

Please contact the server administrator, webmaster@domain.directory.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Apache Server at http://www.domain.com Port 80

Newbie

Posts

Joined
Fri Jun 26, 2015 4:40 am

Post by deepvision » Sun Jun 28, 2015 12:54 pm

The following code

Code: Select all

RewriteCond %{QUERY_STRING} ^route=product/category&path=37$
RewriteRule ^index\.php$ http://www.domain.com/new-resource? [R=301,L]
should appear after:

Code: Select all

RewriteBase /
And you put it before

Code: Select all

RewriteBase /
But it would be better if you don't used those redirects and explained what you tried to achieve in the first place.

ImageImageImage


User avatar
Active Member

Posts

Joined
Tue May 19, 2015 1:03 am

Post by markjacks » Sun Oct 11, 2015 11:04 pm

Hi gurjyot , would be kind enough please on the changes you made to fix this 500 error issue? Thanks!

New member

Posts

Joined
Sun Nov 30, 2014 1:48 pm

Post by deepvision » Thu Oct 15, 2015 12:07 pm

It can be anything. In order to fix it properly you should contact the server error logs (available in cpanel) for the error details. And then it can be fixed.
markjacks wrote:Hi gurjyot , would be kind enough please on the changes you made to fix this 500 error issue? Thanks!

ImageImageImage


User avatar
Active Member

Posts

Joined
Tue May 19, 2015 1:03 am
Who is online

Users browsing this forum: No registered users and 34 guests