Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hi there,

When I enable the Pretty URLs in the config.php I get a weird error saying that the site has a redirect loop. Odd thing is that the template doesn't use any redirect tags anywhere in the code and I can still access the admin section of the site. The site in question is http://blackocean.futuredeluxe.co.uk and the .htaccess file in use can be found below.

The site is pretty heavy on the javascript and makes use of hashbangs but we would still like to make the content accessible via the pretty URL especially for the news section of the site.

Code: Select all
Options +Indexes +FollowSymlinks -MultiViews
<IfModule mod_rewrite.c>
RewriteEngine On

#If your website is installed in a subfolder, change the line below to reflect the path to the subfolder.
#e.g. for http://www.example.com/subdomain1/subdomain2/ make it RewriteBase /subdomain1/subdomain2
RewriteBase /

#If you wish to use a custom 404 page, place a file named 404.php in your website's root and uncomment the line below.
#If your website is installed in a subfolder, change the line below to reflect the path to the subfolder.
#e.g. for http://www.example.com/subdomain1/subdomain2/ make it ErrorDocument 404 /subdomain1/subdomain2/404.php
#ErrorDocument 404 /404.php

#If your site begins with 'www', uncomment the following two lines
#RewriteCond %{HTTP_HOST} !^www\.
#RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]


#DO NOT EDIT BELOW THIS

RewriteRule ^index.php$ "" [R=301,L,QSA]

RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule . - [L]

#strategy.php
RewriteRule ^strategy$ "$0/" [R=301,L,QSA]
RewriteRule ^strategy/$ strategy.php [L,QSA]
RewriteRule ^strategy/.*?([^\.\/]*)\.html$ strategy.php?pname=$1 [L,QSA]
RewriteRule ^strategy/([1-2]\d{3})/(?:(0[1-9]|1[0-2])/(?:(0[1-9]|1[0-9]|2[0-9]|3[0-1])/)?)?$ strategy.php?d=$1$2$3 [L,QSA]
RewriteRule ^strategy/[^\.]*?([^/\.]*)/$ strategy.php?fname=$1 [L,QSA]
RewriteRule ^strategy/[^\.]*?([^/\.]*)$ "$0/" [R=301,L,QSA]

#news.php
RewriteRule ^news$ "$0/" [R=301,L,QSA]
RewriteRule ^news/$ news.php [L,QSA]
RewriteRule ^news/.*?([^\.\/]*)\.html$ news.php?pname=$1 [L,QSA]
RewriteRule ^news/([1-2]\d{3})/(?:(0[1-9]|1[0-2])/(?:(0[1-9]|1[0-9]|2[0-9]|3[0-1])/)?)?$ news.php?d=$1$2$3 [L,QSA]
RewriteRule ^news/[^\.]*?([^/\.]*)/$ news.php?fname=$1 [L,QSA]
RewriteRule ^news/[^\.]*?([^/\.]*)$ "$0/" [R=301,L,QSA]

#global.php
RewriteRule ^global$ "$0/" [R=301,L,QSA]
RewriteRule ^global/$ global.php [L,QSA]
RewriteRule ^global/.*?([^\.\/]*)\.html$ global.php?pname=$1 [L,QSA]
RewriteRule ^global/([1-2]\d{3})/(?:(0[1-9]|1[0-2])/(?:(0[1-9]|1[0-9]|2[0-9]|3[0-1])/)?)?$ global.php?d=$1$2$3 [L,QSA]
RewriteRule ^global/[^\.]*?([^/\.]*)/$ global.php?fname=$1 [L,QSA]
RewriteRule ^global/[^\.]*?([^/\.]*)$ "$0/" [R=301,L,QSA]

#contact.php
RewriteRule ^contact$ "$0/" [R=301,L,QSA]
RewriteRule ^contact/$ contact.php [L,QSA]
RewriteRule ^contact/.*?([^\.\/]*)\.html$ contact.php?pname=$1 [L,QSA]
RewriteRule ^contact/([1-2]\d{3})/(?:(0[1-9]|1[0-2])/(?:(0[1-9]|1[0-9]|2[0-9]|3[0-1])/)?)?$ contact.php?d=$1$2$3 [L,QSA]
RewriteRule ^contact/[^\.]*?([^/\.]*)/$ contact.php?fname=$1 [L,QSA]
RewriteRule ^contact/[^\.]*?([^/\.]*)$ "$0/" [R=301,L,QSA]

#companies.php
RewriteRule ^companies$ "$0/" [R=301,L,QSA]
RewriteRule ^companies/$ companies.php [L,QSA]
RewriteRule ^companies/.*?([^\.\/]*)\.html$ companies.php?pname=$1 [L,QSA]
RewriteRule ^companies/([1-2]\d{3})/(?:(0[1-9]|1[0-2])/(?:(0[1-9]|1[0-9]|2[0-9]|3[0-1])/)?)?$ companies.php?d=$1$2$3 [L,QSA]
RewriteRule ^companies/[^\.]*?([^/\.]*)/$ companies.php?fname=$1 [L,QSA]
RewriteRule ^companies/[^\.]*?([^/\.]*)$ "$0/" [R=301,L,QSA]

#about.php
RewriteRule ^about$ "$0/" [R=301,L,QSA]
RewriteRule ^about/$ about.php [L,QSA]
RewriteRule ^about/.*?([^\.\/]*)\.html$ about.php?pname=$1 [L,QSA]
RewriteRule ^about/([1-2]\d{3})/(?:(0[1-9]|1[0-2])/(?:(0[1-9]|1[0-9]|2[0-9]|3[0-1])/)?)?$ about.php?d=$1$2$3 [L,QSA]
RewriteRule ^about/[^\.]*?([^/\.]*)/$ about.php?fname=$1 [L,QSA]
RewriteRule ^about/[^\.]*?([^/\.]*)$ "$0/" [R=301,L,QSA]

#index.php
RewriteRule ^.*?([^\.\/]*)\.html$ ?pname=$1 [L,QSA]
RewriteRule ^([1-2]\d{3})/(?:(0[1-9]|1[0-2])/(?:(0[1-9]|1[0-9]|2[0-9]|3[0-1])/)?)?$ ?d=$1$2$3 [L,QSA]
RewriteRule ^[^\.]*?([^/\.]*)/$ ?fname=$1 [L,QSA]
RewriteRule ^\w[^\.]*?([^/\.]*)$ "$0/" [R=301,L,QSA]
</IfModule>

Appreciate any light you could shed on this issue.

M
Hi M,

Prima facie nothing seems wrong with the .htaccess.
Could you please PM me your site's FTP + Couch admin credentials?
I'll need to take a look at the issue first-hand to reach any conclusion.

Thanks
Hi,

Thank you for sending in the creds.

I had a look and the problem was this setting in your 'config.php':
// 1.
// If neccesary, define the full URL of your site including the subdomain, if any.
// V.IMP: Don't forget the trailing slash!
define( 'K_SITE_URL', '/' );

This setting is normally required only in exceptional cases where Couch fails to recognize the site's URL. And even then it expects the full URL of the site as its value - which was not the case with your site and ergo the infinite loop.

To fix it I simply commented out the setting (I could have set it to 'http://blackocean.futuredeluxe.co.uk/' but that was not necessary.

Please check and confirm if everything is working as expected.

Thanks
Thank you so much for this. Issue is sorted. Much much appreciated.

Regards,
M
4 posts Page 1 of 1
cron