define('BASE_URL', ''); and SEO


I have had a question from a client where a SEO specialist was saying that - define('BASE_URL', ''); - will not make a 301 redirect from to

Is this correct or not?

He also stated that to make this to work we have to do the redirect in htaccess.

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^[nc]
RewriteRule ^(.*)$$1 [r=301,nc]

If this is correct and the site also have "Pretty URL" set. Where should we insert the example code in the htaccess file?

Please advice...


View Replies:
mesuva replied on at Permalink Reply
To force a site to use the www version of it's domain, I normally change my .htaccess file to look like:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]

I like this version of the redirect as it's not specific to a site, so it can be dropped in without needing an edit every time.

I don't know myself if using the BASE_URL define redirect sends a 301, hence why I use the htaccess redirect above instead.
maar replied on at Permalink Reply
Thanks for your answer. I was aware about this and I am also beginning to use this instead of the BASE_URL directive.

But I am still curious about what the BASE_URL actually is doing regarding SEO.

But thanks again.
cainKuri replied on at Permalink Reply
did you found your answer ?

I'm looking fordward for me...

i have this site wich in :‎...‎

Show me the same status :
Status: HTTP/1.1 302 Moved Temporarily

I wonder why is that since in my .htaccess i have 301 :
RewriteRule ^/?$ "http\:\/\/cheftech\.ca\/" [R=301,L]
maar replied on at Permalink Reply
I am not sure what you want to accomplish with:
RewriteRule ^/?$ "http\:\/\/cheftech\.ca\/" [R=301,L]

As I understand you are trying to redirect if you have a URL with some get variables attached.

What is it you want to do?

What we talked about abowe was to force www. to a URL.
SheldonB replied on at Permalink Reply
not sure of your set up/server (or if this is a correct way to think of this problem)

But using a hosting company isn't there usually 2 redirects before a url??

Ip -> server. url -> Directory

I have had instances where the Ip wasn't directly pointing to the URL i wanted(it was pointing to an extra one as the primary, instead of the one I wanted) so in the server settings I had to change the main URL

If I wanted but was set to my main and I had my .htaccess set up to even though I only saw when a search engine looked it would first see because that's what the Ip told it to go then it was redirected

Im just pointing this out because in my server settings there is a redirect rule to use WWW. or not or both before a user is allowed to see the .htaccess
cainKuri replied on at Permalink Reply
Yes i almost understand the logic...
I'm using a hosting... in the .htaccess is where i see the lines i write before here.

In your explanation, where are those redirects ? before de url ?

thank you so much for your help... maybe i need some kind of diagram, is there any knowledge base ?.... thank you so much for your answer !