Need to remove www from 2nd level subdomain generically in Apache (using rewrite)?

You may use the rewrite module to remove the When it precedes a sub-domain. In this way, an address like:

Sub1.domain. Com would be redirected to sub1.domain.Com: IfModule mod_rewrite. C> Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST}!

Www.domain.Com$ NC RewriteCond %{HTTP_HOST} ^www\.(.*) NC RewriteRule ^(.*)$ http://%1/$1 R=301,NC,L.

You may use the rewrite module to remove the When it precedes a sub-domain. In this way, an address like:

Sub1.domain. Com would be redirected to sub1.domain.Com: Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST}! Www.domain.

Com$ NC RewriteCond %{HTTP_HOST} ^www\.(.*) NC RewriteRule ^(.*)$ http://%1/$1 R=301,NC,L.

Is this the right way to add it to my . Htaccess (its drupal). Or do I need to remove the L in the first rewrite rule.

-- thanks RewriteEngine on ### ADDED RewriteCond %{HTTP_HOST}! Www.domain. Com$ NC RewriteCond %{HTTP_HOST} ^www\.(.*) NC RewriteRule ^(.*)$ http://%1/$1 R=301,NC,L #### RewriteCond %{REQUEST_FILENAME}!

-f RewriteCond %{REQUEST_FILENAME}! -d RewriteCond %{REQUEST_URI}! =/favicon.

Ico RewriteRule ^(.*)$ index. Php? Q=$1 L,QSA.

Also would be nice to make the first RewriteCond generic so the domain name will not matter. E. G would this work (If it is not a domain of the form www.nnnnnnn.

Sss) So now the only question would how the RewriteRule is it still %1 or now it's %3? ### ADDED RewriteCond %{HTTP_HOST}! ^www\.(^\..*)\.(^\..*)$ NC RewriteCond %{HTTP_HOST} ^www\.(.*) NC RewriteRule ^(.*)$ http://%1/$1 R=301,NC,L.

Modified tested solution but for http only. #Allow domain of the form domain.com RewriteCond %{HTTP_HOST}! ^www\.(^\..*)\.(^\..*)$ NC #Otherwise any other form must be rewritten to remove www RewriteCond %{HTTP_HOST} ^www\.(.*) NC #Substitue the complete domain using group %1 in the parentheses of the above condition RewriteRule ^(.*)$ http://%1/$1 R=301,NC,L.

I'm trying to use LocationMatch to match an URL in a website's second-level subdomain but not in it's third-level subdomain. This is because I want to password protect some URLs at that level. Level2.domain.com/some/url should match but not level3.

Than I would apply the necessary directives to password protect the URLs. Does LocationMatch match this part or the URL?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions