Page 1 of 1

[SOLVED] Redirect to FTP Folder

Posted: Thu Jun 27, 2013 2:53 pm
by peterbisset
Hi guys,

I have been puzzling over this for about a week now.

I have a problem on this website: http://www.starwarsepisode7-movie.com where if you click on any of the links it creates a redirect to the ftp folder on the server in this case /starwars7/. I cannot for the life of me work out what the problem is, I have the exact same setup on this website: http://www.riddick-movie.com and the links work fine without a redirect, the only difference being that this website sits on the server root folder and the other one in the ftp subfolder.

The websites are hosted with Godaddy and I tried to contact them to see if there was anything wrong with the server but they assured me that it was to do with the configuration of my CMS.

Config, .htaccess and system info below, any ideas anyone?

.htaccess file:

Code: Select all


# Attempt to override some php settings, these settings may be helpful on some hosts if your
# default configuration does not meet CMS's minimum requirements, and your host
# has given your account appropriate permissions
#php_value upload_max_filesize "10M"
#php_value session_save_path "tmp/cache"

#php_flag magic_quotes_gpc Off
#php_flag register_globals Off
#php_flag session.use_trans_sid Off

# (this is important, so uncomment if your host permit)
#Options -Indexes
#ServerSignature Off

#Options +FollowSymLinks
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^starwarsepisode7-movie.com [NC]
RewriteRule ^(.*)$ http://www.starwarsepisode7-movie.com/$1 [L,R=301] 

# To prevend E_STRICT problems with PHP 5.3+ you can uncomment the following lines
# Note: These settings should only be enabled for production sites!
#php_flag display_startup_errors 0
#php_flag display_errors 0
#php_flag html_errors 0
#php_value docref_root 0
#php_value docref_ext 0

<IfModule mod_rewrite.c>
RewriteEngine on
#
#Sub-dir e.g: /cmsms
RewriteBase /

# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
# but ignore POST requests.
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteCond %{REQUEST_METHOD} !POST$
RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]

# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
</IfModule>

<IfModule mod_header.c>
# Disable ETags
Header unset ETag
FileEtag None
</IfModule>

<IfModule mod_deflate.c>
# Compress css, plaintext, xml, gif, and images in transport.
AddOutputFilterByType DEFLATE text/css text/plain text/xml image/gif image/jpeg image/png
</IfModule>

<IfModule mod_expires.c>
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
# Set expires tags on various files... so that the browser wont attempt to reload them.
ExpiresActive On
ExpiresDefault "access plus 1 year"
<IfModule mod_header.c>
  # Setting cache control to public allowes proxy servers to cache the items too.
  Header set Cache-Control "public"
</IfModule>
</FilesMatch>
</IfModule>
Config file:

Code: Select all

<?php
# CMS Made Simple Configuration File
# Documentation: /doc/CMSMS_config_reference.pdf
#
$config['dbms'] = 'mysqli';
$config['db_hostname'] = 'starwarsepisode7.db.10958864.hostedresource.com';
$config['db_username'] = 'REMOVED';
$config['db_password'] = 'REMOVED';
$config['db_name'] = 'starwarsepisode7';
$config['db_prefix'] = 'cms_';
$config['timezone'] = 'Europe/London';
$config['url_rewriting'] = 'mod_rewrite';
?>

System Information:
----------------------------------------------

Cms Version: 1.11.5

Installed Modules:

CMSMailer: 5.2.1
CMSPrinting: 1.0.4
FileManager: 1.4.3
MenuManager: 1.8.5
MicroTiny: 1.2.5
ModuleManager: 1.5.5
News: 2.12.12
Search: 1.7.8
ThemeManager: 1.1.8
FormBuilder: 0.7.3
RSS2HTML: 1.2.5.2
Gallery: 1.6.1
CGSimpleSmarty: 1.6.1
CGExtensions: 1.33
CGFeedback: 1.5.11
XMLMadeSimple: 0.1.2
CGFeedMaker: 1.0.17
Captcha: 0.4.6
SiteMapMadeSimple: 1.2.7


Config Information:

php_memory_limit:
process_whole_template:
output_compression:
max_upload_size: 32000000
url_rewriting: mod_rewrite
page_extension:
query_var: page
image_manipulation_prog: GD
auto_alias_content: true
locale:
default_encoding: utf-8
admin_encoding: utf-8
set_names: true


Php Information:

phpversion: 5.3.24
md5_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
E_STRICT: 0
E_DEPRECATED: 8192
memory_limit: 64M
max_execution_time: 30
output_buffering: On
safe_mode: Off (False)
file_uploads: On (True)
post_max_size: 33M
upload_max_filesize: 32M
session_save_path: /home/content/64/10958864/tmp (0705)
session_use_cookies: On (True)
xml_function: On (True)
xmlreader_class: On (True)


Server Information:

Server Api: cgi-fcgi
Server Db Type: MySQL (mysqli)
Server Db Version: 5.0.96
Server Db Grants: Could not find a suitable "GRANT ALL" permission. This may mean you could have problems installing or removing modules. Or even adding and deleting items, including pages


----------------------------------------------

Re: Redirect to FTP Folder

Posted: Thu Jun 27, 2013 3:46 pm
by Jo Morg
Its working ok for me

Re: Redirect to FTP Folder

Posted: Thu Jun 27, 2013 4:36 pm
by peterbisset
Jo Morg wrote:Its working ok for me
I think you may have misunderstood, try the following:

Go to the homepage and click on "News" it should take you to:
http://www.starwarsepisode7-movie.com/news/ that is where the link points, however when you click on the link it actually takes you to: http://www.starwarsepisode7-movie.com/starwars7/news/.

See the difference:
http://www.starwarsepisode7-movie.com/news/
http://www.starwarsepisode7-movie.com/starwars7/news/

The "starwars7" folder is the the ftp folder on the server. You need to do this once on the website because if you just click on the link here it will take you to the correct location.

Re: Redirect to FTP Folder

Posted: Thu Jun 27, 2013 5:45 pm
by Jo Morg
I see your point.
I'm not an expert in .htaccess directives but it seems to me that the one posted is too complicated and may have some conflicts.
I would test commenting out some of the directives and test if the site works as expected.
I would even try to go one step further: rename the file you currently have and try the one provided with the CMSMS installation (should be in the docs folder of the archive), to see if the issue remains.
I don't see any other motive for the redirect when the links are generated correctly by CMSMS.

Re: Redirect to FTP Folder

Posted: Thu Jun 27, 2013 6:13 pm
by Rolf
Is this website in a subfolder starwars7?
If so you need to set in the website root .htaccess file:

Code: Select all

#Sub-dir e.g: /cmsms
RewriteBase /starwars7

Re: Redirect to FTP Folder

Posted: Thu Jun 27, 2013 6:28 pm
by Jo Morg
Rolf wrote:Is this website in a subfolder starwars7?
If so you need to set in the website root .htaccess file:

Code: Select all

#Sub-dir e.g: /cmsms
RewriteBase /starwars7
True if the domain doesn't point to already to the subfolder and 'http://www.starwarsepisode7-movie.com/starwars7/ is then needed to access the CMSMS. I don't think that is the problem, though :). I may be wrong ;)

Re: Redirect to FTP Folder

Posted: Fri Jun 28, 2013 9:36 am
by velden
Rolf might have a good point there.

It goes wrong after a 301 redirection (triggered by the rule in htaccess that requires a trailing slash).

Code: Select all

# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
# but ignore POST requests.
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteCond %{REQUEST_METHOD} !POST$
RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]
I don't understand this rule (don't know why it is important to end with /), but it's the one that redirects you to the wrong folder. Fill in the base like Rolf suggest and test. Then you know.

Re: Redirect to FTP Folder

Posted: Fri Jun 28, 2013 5:49 pm
by Dr.CSS
How you got a site to show up from your "FTP" folder I don't know but I would put all the sites in a folder in the root then redirect the domains to them, never use FTP folder...

Re: Redirect to FTP Folder

Posted: Fri Jun 28, 2013 5:50 pm
by peterbisset
Thank you Rolf and Velden you were absolutely correct, I removed this and it worked! I had never had a website sitting in a subfolder on a directory like this before so had never encountered the issue.

The reason I had the bit of code to force the / in the url was for canonical reasons, i.e. to have all versions of the domain pointing to the exact same page. I'm quite pedantic with my SEO and wanted Google to only see one version of the page. I probably take it a bit too far but I like to leave no stone unturned.

I think I can live without it though :)

Once again thanks guys!

Re: Redirect to FTP Folder

Posted: Fri Jun 28, 2013 5:53 pm
by peterbisset
Dr.CSS wrote:How you got a site to show up from your "FTP" folder I don't know but I would put all the sites in a folder in the root then redirect the domains to them, never use FTP folder...
I have the subfolders because with Godaddy you have to pay for extra hosting to have seperate root folders. Therefore I have several domains pointing to various subfolders within the root.

Re: [SOLVED] Redirect to FTP Folder

Posted: Fri Jun 28, 2013 6:03 pm
by Dr.CSS
You had me at GoDuddy...

Now to wash my eyes out...

Re: [SOLVED] Redirect to FTP Folder

Posted: Fri Jun 28, 2013 6:08 pm
by peterbisset
Dr.CSS wrote:You had me at GoDuddy...

Now to wash my eyes out...
Haha fair comment, although I've never really had any problems thus far... (famous last words)

Who would you recommend as a host?

Re: [SOLVED] Redirect to FTP Folder

Posted: Fri Jun 28, 2013 6:30 pm
by Dr.CSS
One of our sponsors at the bottom of these pages or look at http://www.cmsmadesimple.org/partners/...

Re: [SOLVED] Redirect to FTP Folder

Posted: Fri Jun 28, 2013 8:47 pm
by Jo Morg
Ok. I have to admit: I didn't (and still don't) understand your 1st and 2nd posts. Maybe it is the language barrier... But I understood you didn't want the url with the subfolder...
But all is well when it ends well. Glad you solved it :)