News:
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
2012-05-19, 19:16:33

Login with username, password and session length

Pages: [1]   Go Down
  Print  
Author Topic: Problem with SMF forum  (Read 784 times)
studentifisica
Member
*
Offline Offline

Posts: 5


« on: 2010-10-05, 17:39:10 »

Hi PiotrGDR!!
How are you? Do you remember me?
I'm sorry for what happened between you and the 100mb administration. The forum is much less lively now.
I would like to ask you a question, maybe you can help me:

I'm trying to install SMF 2.0 RC3 forum on my website www.studentifisica.info, the installation goes fine. Then I can't administer, post or reply even to the first topic, it redirects me to the index.php. Now I can't logout. On an earlier installation in august if I logged out from the admin panel I couldn't login back, it said "You should fill in a username".

You can check by yourself what happens creating an account here http://www.studentifisica.info/test/smf1


I think the issue may be in my .htaccess redirection, I have only one .htaccess in my root directory and it's this:

Code:
# rewrite URLs all to www.studentifisica.info
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP:VIA} !www\.studentifisica\.info$ [OR]
RewriteCond %{HTTP_HOST} !studentifisica\.info$
RewriteRule ^(.*)$ http://www.studentifisica.info/$1 [R=301,L]

# custom error documents
ErrorDocument 400 "<h1>Bad Request</h1>"
ErrorDocument 401 "<h1>Authorization Required</h1>"
ErrorDocument 402 "<h1>Payment Required (not used yet)</h1>"
ErrorDocument 403 "<h1>Forbidden</h1>"
ErrorDocument 404 /errordocs/error-404.html
ErrorDocument 405 "<h1>Method Not Allowed</h1>"
ErrorDocument 406 "<h1>Not Acceptable (encoding)</h1>"
ErrorDocument 407 "<h1>Proxy Authentication Required</h1>"
ErrorDocument 408 "<h1>Request Timed Out</h1>"
ErrorDocument 409 "<h1>Conflicting Request</h1>"
ErrorDocument 410 "<h1>Gone</h1>"
ErrorDocument 411 "<h1>Content Length Required</h1>"
ErrorDocument 412 "<h1>Precondition Failed</h1>"
ErrorDocument 413 "<h1>Request Entity Too Long</h1>"
ErrorDocument 414 "<h1>Request URI Too Long</h1>"
ErrorDocument 415 "<h1>Unsupported Media Type</h1>"
ErrorDocument 500 "<h1>Internal Server Error</h1>"
ErrorDocument 501 "<h1>Not Implemented</h1>"
ErrorDocument 502 "<h1>Bad Gateway</h1>"
ErrorDocument 503 "<h1>Service Unavailable</h1>"
ErrorDocument 504 "<h1>Gateway Timeout</h1>"
ErrorDocument 505 "<h1>HTTP Version Not Supported</h1>"

I've also noted that in the database I have some fields collated as latin1_swedish_ci even if my default type is utf8_general_ci. Is it an issue?
I have similar problems with wordpress, Drupal and  SMF 1.11

Thank you very much!!


--------
edit: [code] tags added - Piotr GRD
« Last Edit: 2010-10-05, 18:50:10 by Piotr GRD » Logged
Piotr GRD
Administrator
Member
*****
Offline Offline

Posts: 25



« Reply #1 on: 2010-10-05, 18:48:34 »

Hi, of course I remember. : )
Welcome on this forum, it's even less lively than original 110mb one. ; )


I think that this can be related to the way how 110mb servers handle "www" subdomain - every "with www" request is going through internal proxy to "non-www" address, so HTTP_HOST and SERVER_NAME never contain the "www" part. And because this is very unusual servers configuration alot of scripts have a problem in such case. I think that you will need to use "non-www" address for these scripts if hosted on 110mb.

Try to remove your redirection to "with-www" (comment-out or remove this line):
Code:
# RewriteCond %{HTTP:VIA} !www\.studentifisica\.info$ [OR]
and access "non-www" address for confirmation.


Logged
studentifisica
Member
*
Offline Offline

Posts: 5


« Reply #2 on: 2010-10-05, 22:28:14 »

Thank you for your fast answer!
I've commented out that line and the forum works great. But if do this change to the root .htaccess I'll lose all the rewriting that I'm doing for the rest of my site. Is it possible to apply those changes only to a subfolder?
Would an address as forum.studentifisica.info circumvent this problem, assuming that I'm able to do a new DNS A record at my domain registrar?

Logged
Piotr GRD
Administrator
Member
*****
Offline Offline

Posts: 25



« Reply #3 on: 2010-10-06, 03:42:16 »

In theory you could create a subdomain for your forum, but as 110mb don't support subdomains you would need to add it to a different 110mb account, not the same one. Supposedly they are working on the way to allow multiple domain names assigned to one 110mb account (for the "premium" ones with monthly/yearly payments only), but don't count on it before their new version of panel will be done and I still see some potential problems that they can encounter with this.

Yes, you can have separate .htaccess for every folder you wish. Simply leave the root .htaccess as is and create new .htaccess files inside of the folder with the forum. The file with only "RewriteEngine on" will be enough that the rules from root .htaccess won't have effect inside this folder. Alternatively you can put the redirection to non-www URL inside this folder. I'm not sure if you won't need to change the "RewriteBase /foldername/" line, I didn't test it on 110mb.

« Last Edit: 2010-10-06, 03:44:45 by Piotr GRD » Logged
studentifisica
Member
*
Offline Offline

Posts: 5


« Reply #4 on: 2010-10-07, 16:02:08 »

I've tried with many versions of .htaccess and only a few of them worked without giving me a timeout error or a loop redirection (that's the reason I've had to comment out the HTTP:via rule). I've put this working version in the folder /test/ and the forum is in /test/smf1/:

Code:
# rewrite URLs all to studentifisica.info/
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
# RewriteCond %{HTTP:VIA} !www\.studentifisica\.info$ [OR]
RewriteCond %{HTTP_HOST} !^studentifisica\.info$
RewriteRule ^(.*)$ http://studentifisica.info/$1 [R=301,L]

# rewrite URLs with /test/ to studentifisica.info/test/
# RewriteRule ^(.*)/test/(.*)$ http://studentifisica.info/test/$2 [R=301,L]

I didn't find any difference changing the RewriteBase folder and I'm still having some problems because the renaming doesn't work right:
1) if I open http://www.studentifisica.info/test/smf1/ the address remains the same, only if click on something it changes to studentifisica.info.
2) if I open http://studentifisica.110mb.com/test/smf1/ it goes to www.studentifisica.info/smf1/ which gives a 404 error.

Do you have any clue on what's wrong?
Thank you very much in advance!
Logged
Piotr GRD
Administrator
Member
*****
Offline Offline

Posts: 25



« Reply #5 on: 2010-10-07, 18:17:45 »

So if you want to use "with-www" URLs everywhere within your website except "test" folder, where you need to use "non-www" URLs, then:

1st .htaccess in the root folder:
Code:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP:VIA} !www\.studentifisica\.info$ [OR]
RewriteCond %{HTTP_HOST} !^studentifisica\.info$
RewriteRule ^(.*)$ http://www.studentifisica.info/$1 [R=301,L]

2nd .htaccess inside the "test" folder:
Code:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP:VIA} www\.studentifisica\.info$ [OR]
RewriteCond %{HTTP_HOST} !^studentifisica\.info$
RewriteRule ^(.*)$ http://studentifisica.info/test/$1 [R=301,L]

Tested. Works for me.
Everything outside the "test" folder is redirected to "with-www" address.
Everything inside the "test" folder is redirected to "non-www" address.


If any issues - play with RewriteBase in the 2nd .htaccess that is inside the subfolder.

« Last Edit: 2010-10-07, 18:19:16 by Piotr GRD » Logged
studentifisica
Member
*
Offline Offline

Posts: 5


« Reply #6 on: 2010-10-07, 18:44:47 »

Perfect! that's the right solution! Thank you very much!
I've understood what was the problem:
On the 110mb's forum you posted the solution for the redirection with
Code:
RewriteCond %{HTTP_HOST} !sitename\.com$
but the right thing is with the ^:
Code:
RewriteCond %{HTTP_HOST} !^sitename\.com$

I had the root .htaccess without the ^ and putting it only in the second one wasn't enough.
Logged
Piotr GRD
Administrator
Member
*****
Offline Offline

Posts: 25



« Reply #7 on: 2010-10-07, 19:23:21 »

Actually this should does not matter at all in this case.

^ in regular expressions means the beginning, that something start with the following character.
$ in regular expressions means the end, that something ends with the character just before it.
! means negation, logical NOT.

In this case it does not really matter if in the line with HTTP_HOST you'll include ^ or not. I've just did a copy, paste, modify from your previous message in here, that's why in here it is, while on 110mb forum it's without. Without ^ even more safe and compatible for the case of moving this .htaccess as is into another webhost or (I doubt it) in case of 110mb change the way "www" subdomain is handled.

But I'm happy it works for you. : )


(not)Surprisingly there's no any reply in your topic for two days already on 110mb forum...

« Last Edit: 2010-10-07, 19:29:27 by Piotr GRD » Logged
studentifisica
Member
*
Offline Offline

Posts: 5


« Reply #8 on: 2010-10-07, 19:34:21 »

I've tried earlier the exact .htaccess you have posted but it didn't work right until I put the ^ in the root .htaccess . The options are two:
1) I've made a mess when I was trying (but now it works)
2) It is really needed.

I've just checked and you are right, the ^ isn't critical, it works with and without it. So the option 1) is true  Grin  Roll Eyes My bad  Cheesy

Thank you very much another time.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by SMF | SMF © 2006-2009, Simple Machines LLC | Dilber MC Theme by HarzeM modified by Piotr GRD