• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Question -> Redirecting to www and Google Analytics?!



Hello. I want to redirect my url brainlag.eu to www.brainlag.eu.
This is the htaccess i want to use. I everything correct?
#    Mod_security can interfere with uploading of content such as attachments. If you
#    cannot attach files, remove the "#" from the lines below.
<IfModule mod_security.c>
    SecFilterEngine Off
    SecFilterScanPOST Off

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^brainlag\.eu$
    RewriteRule (.*) http://www.brainlag.eu/$1 [R=301,L]

    #    If you are having problems with the rewrite rules, remove the "#" from the
    #    line that begins "RewriteBase" below. You will also have to change the path
    #    of the rewrite to reflect the path to your XenForo installation.
    #RewriteBase /xenforo

    #    This line may be needed to enable WebDAV editing with PHP as a CGI.
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data/|js/|styles/|install/|favicon\.ico) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
In Google Analytics under "Profilesetup" do i have to use also www or just brainlag.eu? And does any knows if i have to setup anything too in Adsense? Thanks


Well-known member
in addition, you should also set this in google webmaster tools.



and rather than use htaccess you should setup the redirect in your sites-savailable x.net file:

<VirtualHost 173.230.135.xxx:80>
    ServerAdmin xx@gmail.com
    ServerName xx.net
    DocumentRoot /home/xx/www/xx.net/public_html/
    ErrorLog /home/xx/www/xx.net/logs/error.log
    CustomLog /home/xx/www/xx.net/logs/access.log combined


<VirtualHost 173.230.135.xxx:80>
    ServerName www.xx.net
    RedirectMatch permanent ^/(.*) http://xx.net/$1