• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: [SOLVED] Removing www by using .htaccess causes problems
PostPosted: Mon Mar 15, 2010 6:05 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Tue Nov 04, 2008 2:10 pm
Posts: 91
Hi People!

Today I wanted to modify my .htaccess file to "redirect" every URL request from www.example.com/site/ to http://example.com/site/.

I used this code:
Code:
#Rewrites www URLS to non-www URLS
RewriteCond %{HTTP_HOST} ^www.benjamin-karl.com$ [NC]
RewriteRule ^(.*)$ http://benjamin-karl.com/$1 [R=301,L]


Unfortunately there are two problems: The guestbook doesn't work any more (nothing happens when clicking on the button to add a new entry) and I can't access the admin area, because of some reason it requires the www (yes, I could solve it by adding a specific .htaccess file in the admin folder, but itsn't there a more convenient way?)

This is my file right now:
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /

# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
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 [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1&gdir=$0 [QSA]


As some will have noticed, I'm using pretty URLs, maybe that's also reason why it doesn't work.

Every input is welcome ;)
greez, opa

_________________
- Sir, we are sourrounded!
- Excellent, now we can attack in any direction!


Last edited by opawaldburger on Tue Mar 16, 2010 4:23 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Removing www by using .htaccess causes problems
PostPosted: Mon Mar 15, 2010 6:16 pm 
Offline
Administrator
Administrator
User avatar

Joined: Thu Mar 09, 2006 5:32 am
Posts: 10682
Location: Arizona
Have you changed your config.php to reflect that the site now is seen as http;;//site.com and not www  .site

NOTE: the ;; and etc. is so they don't become links...

_________________
Extensions » Modules/Tags click the name of the module/tag or Help to the right to get it's parameters.
Right click and view source is a great way to see what you have to work with.
Check ver. CMSMS, PHP, server OS, in System Information page.
Default content http://multiintech.com/defaultcontent/
People are Wonderful
Business is Great
Life is Terrific
Ever wonder what happened to the Album module? Well it is alive and well.
http://album.multiintech.com/

Image


Top
 Profile  
 
 Post subject: Re: Removing www by using .htaccess causes problems
PostPosted: Mon Mar 15, 2010 6:18 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 4131
Location: The Netherlands
opawaldburger wrote:
Every input is welcome ;)
greez, opa

Perhaps: http://forum.cmsmadesimple.org/index.ph ... 912.0.html

®

_________________
De vijfde Nederlandstalige CMSMS Workshop: Lees meer...
--------------------------
My multilingual website and playground Buispost.eu (Pneumatic Tube System / Rohrpost)
And my other (Dutch) website: Smakelijk eten zonder zout (Design: Compufairy)


Top
 Profile  
 
 Post subject: Re: Removing www by using .htaccess causes problems
PostPosted: Mon Mar 15, 2010 6:31 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Tue Nov 04, 2008 2:10 pm
Posts: 91
@Dr. CSS: Now I did, but unfortunately nothing happened :(
@Rolf: I tried it this way, too, but same problems! Thanks, though!

_________________
- Sir, we are sourrounded!
- Excellent, now we can attack in any direction!


Top
 Profile  
 
 Post subject: Re: Removing www by using .htaccess causes problems
PostPosted: Mon Mar 15, 2010 6:41 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 4131
Location: The Netherlands
Ohh wait  ::)

Try adding these lines in the .htaccess file:

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


Rolf

_________________
De vijfde Nederlandstalige CMSMS Workshop: Lees meer...
--------------------------
My multilingual website and playground Buispost.eu (Pneumatic Tube System / Rohrpost)
And my other (Dutch) website: Smakelijk eten zonder zout (Design: Compufairy)


Top
 Profile  
 
 Post subject: Re: Removing www by using .htaccess causes problems
PostPosted: Mon Mar 15, 2010 6:58 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Tue Nov 04, 2008 2:10 pm
Posts: 91
sry, stays the same. the problem is, that the guestbook requires the "www"
don't ask me why, but obviously that's the problem. for the next 15 minutes I going to have the modified .htaccess uploaded, so when visiting the following site, you can what I mean!
http://benjamin-karl.com/gaestebuch

that's what the file looks now:
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /

# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
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 [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1&gdir=$0 [QSA]

#Rewrites www URLS to non-www URLS
RewriteCond %{HTTP_HOST} ^www.benjamin-karl.com$ [NC]
RewriteRule ^(.*)$ http://benjamin-karl.com/$1 [R=301,L]


greez, opa

_________________
- Sir, we are sourrounded!
- Excellent, now we can attack in any direction!


Top
 Profile  
 
 Post subject: Re: Removing www by using .htaccess causes problems
PostPosted: Mon Mar 15, 2010 7:09 pm 
your form:


logisch dass net funzt ;)

only one (or a few) change(s) in the template(s) schould solve the problem - only look where in the guestbook templates you have www.

EDIT: Sorry, I had to correct my "austrian english"


Last edited by owr_bgld on Tue Mar 16, 2010 11:14 am, edited 1 time in total.

Top
  
 
 Post subject: Re: Removing www by using .htaccess causes problems
PostPosted: Mon Mar 15, 2010 7:11 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 4131
Location: The Netherlands
The fix I posted is for problems with the POST function in combination with a trailing slash in the url, which you have...
Your newsletter form isn't working too  ;) Same problem.

Perhaps:
RewriteRule ^(.+)$ index.php?page=$1&gdir=$0 [QSA]
The default line is
RewriteRule ^(.+)$ index.php?page=$1 [QSA]

Rolf  :)

_________________
De vijfde Nederlandstalige CMSMS Workshop: Lees meer...
--------------------------
My multilingual website and playground Buispost.eu (Pneumatic Tube System / Rohrpost)
And my other (Dutch) website: Smakelijk eten zonder zout (Design: Compufairy)


Top
 Profile  
 
 Post subject: Re: Removing www by using .htaccess causes problems
PostPosted: Mon Mar 15, 2010 7:20 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Tue Nov 04, 2008 2:10 pm
Posts: 91
@owr_bgld: wie woa, wie woa.;) there's just the problem, that I already WANTED changed the URL in the Guestbook-Templates, but there's nothing to change :S

@rolf: changed it to this version:
Code:
RewriteRule ^(.+)$ index.php?page=$1 [QSA]

go visit the site to see what's happening now - not much better, though

greez

_________________
- Sir, we are sourrounded!
- Excellent, now we can attack in any direction!


Last edited by opawaldburger on Mon Mar 15, 2010 7:22 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Removing www by using .htaccess causes problems
PostPosted: Mon Mar 15, 2010 7:23 pm 
aho - sorry that was not really clear thinking - or how do you say in english "shit happens?" I don't work really much with forms (it's a time ago)


You can't change the forms thats right - but did you try changing the config.php - path setting. Make the root url without the www.


Top
  
 
 Post subject: Re: Removing www by using .htaccess causes problems
PostPosted: Mon Mar 15, 2010 7:27 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 4131
Location: The Netherlands
Dr.CSS wrote:
Have you changed your config.php to reflect that the site now is seen as http;;//site.com and not www  .site

NOTE: the ;; and etc. is so they don't become links...


Code:
<base href="http://www.benjamin-karl.com/" />


Tried this yet?:
Code:
#Document root as seen from the webserver.  No slash at the end
#If page is requested with https use https as root url
#e.g. http://blah.com
$config['root_url'] = 'http://benjamin-karl.com';

No www. and no slash at the end.

Rolf  :)

_________________
De vijfde Nederlandstalige CMSMS Workshop: Lees meer...
--------------------------
My multilingual website and playground Buispost.eu (Pneumatic Tube System / Rohrpost)
And my other (Dutch) website: Smakelijk eten zonder zout (Design: Compufairy)


Top
 Profile  
 
 Post subject: Re: Removing www by using .htaccess causes problems
PostPosted: Mon Mar 15, 2010 7:35 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Tue Nov 04, 2008 2:10 pm
Posts: 91
@owr_bgld: Yeah, tried that. But NOTHING happened. I don't know which effects it should take, but the ones I could imagine didn't happen.

@Rolf: I already did that - but as you can see even the base_url doesn't change. already typed it manually and removed the {metadata}-tag - no result!

@all: I am wondering if I'm the only one to rewrite URLs and using the guestbook. Is there anyone who uses the same and could help anyhow - even if you say it works for your site...!?

Thanks to all you three who helped so far!!!

greez, opawaldburger

_________________
- Sir, we are sourrounded!
- Excellent, now we can attack in any direction!


Top
 Profile  
 
 Post subject: Re: Removing www by using .htaccess causes problems
PostPosted: Mon Mar 15, 2010 7:44 pm 
ok wait - mir foit grod wos ei

I had an maybe similar problem - my pretty urls didn't work. For me there was to much code in the .htaccess.

I only need this lines (and this at 4 different servers with four different pages):

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]

I think now you have only to make the changes like Rolf suggested


EDIT: Don't forget to change the root_path in the config without www. again - and sorry, i had to "revise" my english two times


Last edited by owr_bgld on Mon Mar 15, 2010 7:46 pm, edited 1 time in total.

Top
  
 
 Post subject: Re: Removing www by using .htaccess causes problems
PostPosted: Mon Mar 15, 2010 7:52 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 4131
Location: The Netherlands
opawaldburger wrote:
@all: I am wondering if I'm the only one to rewrite URLs and using the guestbook. Is there anyone who uses the same and could help anyhow - even if you say it works for your site...!?

Check http://atmytestsite.com/guestbook.html

Rolf  :)

_________________
De vijfde Nederlandstalige CMSMS Workshop: Lees meer...
--------------------------
My multilingual website and playground Buispost.eu (Pneumatic Tube System / Rohrpost)
And my other (Dutch) website: Smakelijk eten zonder zout (Design: Compufairy)


Top
 Profile  
 
 Post subject: Re: Removing www by using .htaccess causes problems
PostPosted: Mon Mar 15, 2010 8:02 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Tue Nov 04, 2008 2:10 pm
Posts: 91
@owr_bgld: no problem. still, this code won't remove the www trom the URL. This only makes sure that the pretty URLs work ;)
@Rolf: Perfect! That's exactly how it should work! What did you do or not do?

Opa

_________________
- Sir, we are sourrounded!
- Excellent, now we can attack in any direction!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Arvixe - A CMSMS Partner