mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Forum Feedback (https://www.mersenneforum.org/forumdisplay.php?f=61)
-   -   ftp.mersenneforum.org (https://www.mersenneforum.org/showthread.php?t=20232)

Mark Rose 2015-05-06 20:58

ftp.mersenneforum.org
 
I notice that the forum is available at [url]http://ftp.mersenneforum.org[/url] and that Google indexes that. It might be an idea to disable the forum from being accessible on ftp.mersenneforum.org or to set a canonical URL to point to the www version so Google returns results only on www.

TObject 2015-05-07 01:46

Add the following to the Apache host configuration (somewhere within [i]VirtualHost[/i] tag, for example):

[code]
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.mersenneforum\.org$ [NC]
RewriteCond %{SERVER_PORT}s ^(443(s)|[0-9]+s)$
RewriteRule ^(.*)$ http%2://www.mersenneforum.org%{REQUEST_URI} [R=301,L]
[/code]

Xyzzy 2015-05-07 02:44

[QUOTE=TObject;401885]Add the following to the Apache host configuration (somewhere within [I]VirtualHost[/I] tag, for example):

[code]
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.mersenneforum\.org$ [NC]
RewriteCond %{SERVER_PORT}s ^(443(s)|[0-9]+s)$
RewriteRule ^(.*)$ http%2://www.mersenneforum.org%{REQUEST_URI} [R=301,L]
[/code][/QUOTE]Will this work in a directory-specific .htaccess file? We do not have access to the "big boy" file.

(Also, what does it do?)

:buddy:

TObject 2015-05-07 03:04

If the [b]AllowOverride FileInfo[/b] configuration option is set, then this should work from [b].htaccess[/b] file.

Apache [i]mod_rewrite[/i] module is required (usually it is on).

What does this do? It permanently redirects everything that does not look like [url]www.mersenneforum.org[/url] to [url]www.mersenneforum.org[/url], and keeps the correct protocol (http/https) and correct request string after the domain name.

For example, when somebody or a robot goes to
[code]http://ftp.mersenneforum.org/showthread.php?p=401885#post401885[/code]
They/it will be automatically redirected to
[code]http://www.mersenneforum.org/showthread.php?p=401885#post401885[/code]

Xyzzy 2015-05-07 04:05

We applied your change and it looks like it worked. Thanks!

:mike:

TObject 2015-05-07 18:22

You are welcome.

As Google spider re-visits the offending pages it will make a note of the correct destinations and the search index should get updated accordingly. This usually takes a while…

Xyzzy 2015-05-13 17:40

Somehow the new rewrite rules are not working for links like this:

[URL]http://mersenneforum.org/gimps/mprime276-linux64.tar.gz[/URL]

Instead it shows the "banned" message.

:help:

[CODE]ErrorDocument 403 "Your IP address has been banned. If you think this is a mistake, please email xyzzyATmersenneforumDOTorg for assistance."
Options -Indexes
<ifModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/xml text/css text/plain
AddOutputFilterByType DEFLATE image/svg+xml application/xhtml+xml application/xml
AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml
AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript application/json
AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-otf
AddOutputFilterByType DEFLATE font/truetype font/opentype
</ifModule>
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 5 seconds"
ExpiresByType image/x-icon "access plus 604800 seconds"
ExpiresByType image/jpeg "access plus 604800 seconds"
ExpiresByType image/png "access plus 604800 seconds"
ExpiresByType image/gif "access plus 604800 seconds"
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 604800 seconds"
ExpiresByType application/javascript "access plus 604800 seconds"
ExpiresByType application/x-javascript "access plus 604800 seconds"
</ifModule>
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.mersenneforum\.org$ [NC]
RewriteCond %{SERVER_PORT}s ^(443(s)|[0-9]+s)$
RewriteRule ^(.*)$ http%2://www.mersenneforum.org%{REQUEST_URI} [R=301,L]
order allow,deny
Lots of IP addresses!
allow from all[/CODE]

Mark Rose 2015-05-13 18:38

Try changing

RewriteCond %{HTTP_HOST} !^www\.mersenneforum\.org$ [NC]

to

RewriteCond %{HTTP_HOST} ^ftp\.mersenneforum\.org$ [NC]

that will only rewrite links to ftp.mersenneforum.org, not anything that isn't [url]www.mersenneforum.org[/url].

TObject 2015-05-13 20:34

Not sure what is going on here... Check a couple of things, please:
* The [b]/gimps[/b] folder does [i]not[/i] have an .htaccess file of its own, right?
* Is there any evidence in the web server log files (errors are often in a separate log file), maybe file locations looking wrong or folders missing in the file paths?

Xyzzy 2015-05-14 01:16

[QUOTE=Mark Rose;402248]Try changing

RewriteCond %{HTTP_HOST} !^www\.mersenneforum\.org$ [NC]

to

RewriteCond %{HTTP_HOST} ^ftp\.mersenneforum\.org$ [NC]

that will only rewrite links to ftp.mersenneforum.org, not anything that isn't [URL="http://www.mersenneforum.org"]www.mersenneforum.org[/URL].[/QUOTE]We tried the change and it did not fix anything. For now we have commented out the entire section.

Xyzzy 2015-05-14 01:20

[QUOTE=TObject;402253]* The [B]/gimps[/B] folder does [I]not[/I] have an .htaccess file of its own, right?[/QUOTE]Yes, it has one:

[CODE]Options Indexes
IndexIgnore HEADER.html
IndexOptions IgnoreCase FancyIndexing FoldersFirst NameWidth=* SuppressHTMLPreamble SuppressDescription
HeaderName HEADER.html
[/CODE][quote]* Is there any evidence in the web server log files (errors are often in a separate log file), maybe file locations looking wrong or folders missing in the file paths?[/quote]We don't have access to real-time log files. We do have daily archived log files. If you want we could send you one to analyze.


All times are UTC. The time now is 03:48.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.