Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 07-30-2017 05:49:05

robprotronica
Member
Registered: 12-16-2008
Posts: 106

SEO and htaccess

We set our version 9 site live a few weeks ago and have this installed in a /K9/ subdirectory.

When we switched over to the new site we just used  a very simple rewrite rule in the htaccess file :-

Code:

Options +FollowSymLinks
RewriteEngine on

# home page traffic is sent to /K9/index.php

Rewriterule ^$ /K9/index.php

We have just been trying to get SEO friendly links switched on and have replaced our one liner with the site suggested code as follows:-

Code:

Options +FollowSymLinks
RewriteEngine on

# Base Software Rewrite Rules

RewriteRule ^K9/index.php - [L,PT]
RewriteRule ^K9$ K9/index.php?COREseourl=/ [L,PT]
RewriteRule ^K9/$ K9/index.php?COREseourl=/ [L,PT]
RewriteRule ^K9/sitemap\.xml K9/utilities/sitemap.xml [L,PT]
RewriteCond %{REQUEST_URI} ^/K9/
RewriteCond %{REQUEST_URI} !\.(xml|css|js|gif|jpg|jpeg|png|pdf)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^K9/(.*) K9/index.php?COREseourl=/ [L,PT]

With  System / Component / Settings / Search Engine Optimization Settings -> SEO Status, set to "False", everything works as normal with all url's in the ../K9/index.php?app=ecom&ns=catshow&ref=category-name format.

If we switch SEO Status to "True" all url's take the format ../K9/Category/category-name,  ../K9/Item/item-name etc.

HOWEVER - doesn't matter what url is requested in this format the only page that gets displayed is the home page.

requesting a page in the .../index.php?app=... format displays the correct page.

ErrorDocument 404 /K9/index.php was commented out during the test as were other 301 redirects.

Looks like we must have something wrong in the htaccess rules but as far as I can tell these are the correct rules as generated by the site and checked against the documentation. Other posts seem to indicate that these are the rule so not sure where to look at what is causing the SEO friendly url's not to display.

Any suggestions much appreciated.

Thanks

Offline

 

#2 07-31-2017 08:51:14

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19724
Website

Re: SEO and htaccess

RewriteRule ^K9/index.php - [L,PT]

Should be:

RewriteRule ^K9/index\.php - [L,PT]

That might be the missing piece.


Nick Hendler

Offline

 

#3 08-01-2017 06:50:30

robprotronica
Member
Registered: 12-16-2008
Posts: 106

Re: SEO and htaccess

Thanks Nick.

However, this has not solved the problem.

A bit of further testing has revealed that the htaccess file as is does not actually send requests to the K9 directory.

That is with the the htaccess file exactly as generated by the site requests to http://domain.co.uk go to the index file in the root directory and do not get rewriten to ./K9/index.php

Did not initially notice this since all the urls I was testing previously have the /K9/ directory included.

Rewriterule ^$ /K9/

Does take everything to the /K9 directory - but not sure what that does to the other rules.

Testing gave very similar results with everything working with SEO Status set to False but only the home page displaying when set to True.

Maybe I need, "The Definitive Guide to Apache Mod_rewrite" on my wish list.

Offline

 

#4 08-01-2017 07:53:42

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19724
Website

Re: SEO and htaccess

It is improper to go live and redirect all / traffic to /K9.  SEO issues will occur.  Are you going live, or just testing?  If you're just testing, get rid of that redirect rule at the top:

Rewriterule ^$ /K9/

If you're actually going live, you should be moving everything in /K9 to the root and doing proper root rewrites.


Nick Hendler

Offline

 

#5 08-01-2017 08:01:27

robprotronica
Member
Registered: 12-16-2008
Posts: 106

Re: SEO and htaccess

OK so unlike our old V6 site you can't run a live site from a subdirectory.  Missed that bit.

Will move into the root folder and re-run the installer then try the htaccess rules for the root directory.

Offline

 

#6 08-01-2017 08:05:25

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19724
Website

Re: SEO and htaccess

No, you can do it.  It's just advised not to.  If you want to do that, remove that first rule and do it.  It is very bad SEO practice  to take every request pointed to your homepage and rewrite it to a subdirectory - you will lose juice and rank.  You might as well have whatever is in that subdirectory in the root.


Nick Hendler

Offline

 

#7 08-02-2017 09:50:50

robprotronica
Member
Registered: 12-16-2008
Posts: 106

Re: SEO and htaccess

OK have moved everything from K9 to root and all is working fine and I have the htaccess rules working now.

Have also discovered differences in the suggested rules.

/ System / Helpers / SEO Htaccess Builder gives the following code:-

Code:

RewriteRule ^index.php - [L,PT]
RewriteRule ^$ index.php?COREseourl=/ [L,PT]
RewriteRule ^/$ index.php?COREseourl=/ [L,PT]
RewriteRule ^sitemap\.xml utilities/sitemap.xml [L,PT]
RewriteCond %{REQUEST_URI} ^/
RewriteCond %{REQUEST_URI} !\.(xml|css|js|gif|jpg|jpeg|png|pdf)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?COREseourl=/ [L,PT]

The documentation shows the following code:-

Code:

RewriteRule ^index.php - [L,PT]
RewriteRule ^/$ index.php?COREseourl=/ [L,PT]
RewriteRule ^sitemap\.xml utilities/sitemap.xml [L,PT]
RewriteRule ^rss\.xml utilities/rss.xml [L,PT]
RewriteCond %{REQUEST_URI} ^/
RewriteCond %{REQUEST_URI} !\.(xml|css|js|gif|jpg|jpeg|png|pdf)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?COREseourl=/$1 [L,PT]

There is the inclusion of the extra 2nd line in the "helper" code:-

RewriteRule ^$ index.php?COREseourl=/ [L,PT]

Have no idea if this makes any difference just thought I would point it out.

The rules the seem to be working fine for us are the set from the documentation.

Offline

 

#8 08-03-2017 08:16:07

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19724
Website

Re: SEO and htaccess

The helper code is correct, although an update is pending for K9 in which I think there was a change.  Where did you see that .htaccess code you referenced from 'documentation'.  If it's in the K9 beta manual, I need to change it.  Thanks.


Nick Hendler

Offline

 

#9 08-03-2017 08:34:22

robprotronica
Member
Registered: 12-16-2008
Posts: 106

Re: SEO and htaccess

Hi Nick,

Thanks will drop the extra line into my .htaccess.

The code I found in the documentation is here:-

https://kryptronic.com/DEVMANUAL/SEO-an … -Setup.php

Don't know if that is the home of the manual I am supposed to be referring to - it was on a link in an email when K9 got set up and I have been using it ever since.

Offline

 

#10 08-04-2017 07:43:42

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19724
Website

Re: SEO and htaccess

Yes, that's the K9 dev/beta manual.  Thanks for the info, I have to update it.


Nick Hendler

Offline

 

#11 08-22-2017 13:14:16

arame08
Member
Registered: 08-11-2011
Posts: 4

Re: SEO and htaccess

Yes this version really helpful to get switched SEO friendly link.

Offline

 

#12 11-23-2020 14:05:17

Graham
Member
Registered: 09-30-2004
Posts: 979
Website

Re: SEO and htaccess

Bumping an old thread here because I've tried activating SEO friendly URLs in my v9 install, but when I use the code from post #7 above https://forum.kryptronic.com/viewtopic. … 26#p159426 I get a 500 error.

Is there a more up to date version of this?

Offline

 

#13 11-23-2020 19:10:32

Graham
Member
Registered: 09-30-2004
Posts: 979
Website

Re: SEO and htaccess

I've found this in the  Dashboard / System / Component / Settings / Helpers but although the splash page is ok, any time I try to select any other page, eg category, product, account overview etc I get the 500 error.

I'm using cPanel rather than Apache, but I was told by my hosts that it would still work the same.

Code:

# Gzip Compression for Speed

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

# Caching for Speed

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 month"
ExpiresDefault "access plus 1 month"
</IfModule>

# Disable Default Character Set

AddDefaultCharset Off

# Activate Rewite Engine

Options FollowSymLinks
RewriteEngine On

# Custom Rewrite Rules - Add Any Custom Rules Below

# Base Software Rewrite Rules

RewriteRule ^index.php - [L,PT]
RewriteRule ^$ index.php?COREseourl=/ [L,PT]
RewriteRule ^/$ index.php?COREseourl=/ [L,PT]
RewriteRule ^sitemap\.xml utilities/sitemap.xml [L,PT]
RewriteCond %{REQUEST_URI} ^/
RewriteCond %{REQUEST_URI} !\.(xml|css|js|gif|jpg|jpeg|png|pdf)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?COREseourl=/$1 [L,PT]

Offline

 

#14 11-24-2020 08:14:39

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19724
Website

Re: SEO and htaccess

I've found that cPanel servers are very touchy when it comes to editing .htaccess files.  Try using the .htaccess you posted above, but use the WHM file manager to edit and save the file.  cPanel does something to the file encoding that you can't replicate with a change via FTP.


Nick Hendler

Offline

 

#15 11-24-2020 08:41:00

Air Essential
Member
From: Paris
Registered: 11-24-2020
Posts: 1
Website

Re: SEO and htaccess

Thanks for information !

Offline

 

#16 11-24-2020 13:56:37

Graham
Member
Registered: 09-30-2004
Posts: 979
Website

Re: SEO and htaccess

The problem seems to be with the very last line

Code:

RewriteRule ^(.*) index.php?COREseourl=/$1 [L,PT]

If I take that out, there's no 500 error (only a 404)


BTW it seems to be trying to rewrite to https://affordableleather.co.uk/Categor … fs-mittens

Is it possible to change "Category" to "category" with a lower case c to keep things consistent?

Offline

 

#17 11-25-2020 08:13:23

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19724
Website

Re: SEO and htaccess

Your last line looks correct.  I'm not sure what's going on there.  Try putting a break at the end of the line so it's not the last one in the file.  End the file with a blank line and see if that helps. 

Concerning changing the SEOURL base, you can use System / Database / Raw DB Admin to browse the core_namespaces table.  Locate the id 'ecom.catshow' and change it's seourl parameter from 'Category' to 'category'.


Nick Hendler

Offline

 

#18 11-25-2020 10:37:13

Graham
Member
Registered: 09-30-2004
Posts: 979
Website

Re: SEO and htaccess

I added an extra line, but that didn't help

Code:

# Gzip Compression for Speed

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

# Caching for Speed

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 month"
ExpiresDefault "access plus 1 month"
</IfModule>

# Disable Default Character Set

AddDefaultCharset Off

# Activate Rewite Engine

Options FollowSymLinks
RewriteEngine On

# Custom Rewrite Rules - Add Any Custom Rules Below

# Base Software Rewrite Rules

RewriteRule ^index.php - [L,PT]
RewriteRule ^$ index.php?COREseourl=/ [L,PT]
RewriteRule ^/$ index.php?COREseourl=/ [L,PT]
RewriteRule ^sitemap\.xml utilities/sitemap.xml [L,PT]
RewriteCond %{REQUEST_URI} ^/
RewriteCond %{REQUEST_URI} !\.(xml|css|js|gif|jpg|jpeg|png|pdf)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?COREseourl=/$1 [L,PT]

# Extra line to try to fix 500 error

This is the exact error message I'm getting:

Internal Server Error

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

Please contact the server administrator at webmaster@affordableleather.co.uk to inform them of the time this error occurred, and the actions you performed just before this 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.

Offline

 

#19 11-25-2020 20:23:46

Graham
Member
Registered: 09-30-2004
Posts: 979
Website

Re: SEO and htaccess

AAARGH!

I've found the problem! The .htaccess file was in the root, rather than in cPanel's public_html directory.

I moved .htaccess into the public_html file and now it works ok.

Head - > Desk :-/

Offline

 

Board footer