Locking the www in urls

Discussions about SEO Techniques implemented in your sites. Tests, Studies and results analysis.

Moderator: Moderators

Postby Peter77 » Sun May 21, 2006 6:31 pm

dcz wrote:I am a bit confused here, because when I try to load you web site's url without the www, it works without adding the www.


Hmm I did not pay attention to that... I guess the rewrite rules in my .htaccess are not working afterall...

dcz wrote:Then, when I load your Google sitemap url, the output is not exactly the same as what I experience on other sites. The code is correct, but, the output is not shown the same way for the sitemapIndex than for the sitemaps.

have you changed something to the files ? Sorry, I did not opened the mx Google sitemap support thread, but if you experience further problems with this mod, just start a new thread, since this is about mod rewrite adaptation on it.


I havn't touched the sitemap.php file or modified it in any way...

dcz wrote:Then, you are not using the premodded files for phpBB SEO mod rewrite.
Re DL the pack and look in contrib/moded_4_mod_rewrites/phpBB_SEO_mod_Rewrites , your should use the phpBB advanced mod rewrite files instead of the regular one. This will change all your url from viewtopic.php?t=3381&start=15 to topic-title-vt3381-15.html, which are the only URL to consider in your case ;)


are you talking about sitemap_forum.php? so I am supposed to use that and not sitemap.php?
Peter77
phpBB SEO Team
phpBB SEO Team
 
Posts: 524
Joined: Wed May 10, 2006 9:46 am
Location: Michigan

Advertisement

Postby dcz » Mon May 22, 2006 9:28 am

Peter77 wrote:Hmm I did not pay attention to that... I guess the rewrite rules in my .htaccess are not working afterall...


Don't loose faith, it will work some how ;) Again, how many .htaccess are you using and where ?

Peter77 wrote:I havn't touched the sitemap.php file or modified it in any way...

Ok, it's no big deal, since the actual source code is ok.

Peter77 wrote:are you talking about sitemap_forum.php? so I am supposed to use that and not sitemap.php?


Nope, you should just overwrite the sitemap_forum.php file you are actually using with the one located in contrib/moded_4_mod_rewrites/phpBB_SEO_mod_Rewrites/Advanced_Mod_Rewrite
and you URLs will be outputted rewritten ;)
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21238
Joined: Fri Apr 28, 2006 9:03 pm

Postby Peter77 » Tue May 23, 2006 2:15 am

dcz wrote:
Peter77 wrote:Hmm I did not pay attention to that... I guess the rewrite rules in my .htaccess are not working afterall...


Don't loose faith, it will work some how ;) Again, how many .htaccess are you using and where ?


I know, just gets frustrating sometimes. well I had a few .htaccess in some of my mxbb modules includes folders. I only had "Deny all" in it though. I did this cause some script kiddie installed a directory in my root folder some weeks ago. not that its gonna stop them, but thought it might help. well anyway, I took them all out now. so currently there are no .htaccess files besides my root folder.

dcz wrote:
Peter77 wrote:I havn't touched the sitemap.php file or modified it in any way...

Ok, it's no big deal, since the actual source code is ok.

Peter77 wrote:are you talking about sitemap_forum.php? so I am supposed to use that and not sitemap.php?


Nope, you should just overwrite the sitemap_forum.php file you are actually using with the one located in contrib/moded_4_mod_rewrites/phpBB_SEO_mod_Rewrites/Advanced_Mod_Rewrite
and you URLs will be outputted rewritten ;)


Hmm I didn't know about sitemap_forum.php untill the other day. :oops: well it doesn't let me enter. it says hacking attempt. is that normal?

Do you think that maybe I should try the other rewrite rules.. like mixed rewrite or simple rewrite?
Peter77
phpBB SEO Team
phpBB SEO Team
 
Posts: 524
Joined: Wed May 10, 2006 9:46 am
Location: Michigan

Postby dcz » Tue May 23, 2006 9:04 am

Please keep your .htaccess with deny from al in it, the only .htaccess that could mess with this www thing are the one containing rewriterules or Options, but deny and .htpasswd are ok.

Then, I think I do not make it to make you understand what I mean with Google sitemaps.

So, your installation is perfect.

You just have to overwrite the original sitemap_forum.php located in mx_ggsitemaps/includes/ with the one located in contrib/moded_4_mod_rewrites/phpBB_SEO_mod_Rewrites/Advanced_Mod_Rewri te

And please re DL the pack if you hadn't already, cause small errors where fixed last week in the contrib folder files ;)

It's just that the sitemap_forum.php is used to output the forums URL, the original one stands for vanilla URL, the others will rewrite URL accordingly to the selected mod rewrite.

And no more to do as far as Google sitemaps, since the forum rewriterules are already set ;)
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21238
Joined: Fri Apr 28, 2006 9:03 pm

Postby Peter77 » Tue May 23, 2006 10:32 am

Okay, sitemap.php is working correctly now. :)

now just need to get the www issue. sorry if this got off subject.
Peter77
phpBB SEO Team
phpBB SEO Team
 
Posts: 524
Joined: Wed May 10, 2006 9:46 am
Location: Michigan

Postby dcz » Wed May 24, 2006 10:44 am

Peter77 wrote:Okay, sitemap.php is working correctly now. :)

now just need to get the www issue. sorry if this got off subject.


All right :D

So what about the php script?

and would this work ?

Code: Select all
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^site.com/$  [NC]
RewriteRule ^(.*) http://www.site.com/$1 [QSA,R=301,L]


or this :

Code: Select all
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^site.com/$  [NC]
RewriteRule (.*) http://www.site.com/$1 [QSA,R=301,L]


or this :

Code: Select all
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^site.com  [NC]
RewriteRule (.*) http://www.site.com/$1 [QSA,R=301,L]


or this :

Code: Select all
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^site.com  [NC]
RewriteRule ^(.*) http://www.site.com/$1 [QSA,R=301,L]


or this :

Code: Select all
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^site.com$  [NC]
RewriteRule ^(.*) http://www.site.com/$1 [QSA,R=301,L]


or this :
Code: Select all
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^site.com$ [NC]
RewriteRule (.*) http://www.site.com/$1 [QSA,R=301,L]


++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21238
Joined: Fri Apr 28, 2006 9:03 pm

Postby Peter77 » Wed May 24, 2006 10:48 pm

Okay!! I think I got it... I went to my hosting companys support forum. which has more webmasters then support, and one person told me to use this instead.

Code: Select all
suPHP_ConfigPath /home/account_name/public_html
Options Indexes Multiviews +FollowSymlinks

RewriteEngine On

# Redirect asdf.net to www.asdf.net
RewriteCond %{HTTP_HOST} ^example\.net [NC]
RewriteRule (.*) http://www.example.net/$1 [R=301]


and changed mine to

Code: Select all
suPHP_ConfigPath /home/myaccount/public_html
Options Indexes Multiviews +FollowSymlinks
RewriteEngine on
RewriteBase /

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


and it seems to work.

But I have the same .css and images problem. this was more my fault i think. I had the .css and some images pointing to http://mysite.com and changed it to http://www.mysite.com and it works fine now.

Only now I have the same issue with mxbb login.php. it refreshes the page instead of logging in. so again, i have to redirect traffic to the phpbb login.php instead.

I don't have the login URL hardcoded or anything. Im using "{U_LOGIN_LOGOUT}" and ">{L_LOGIN_LOGOUT}

dcz wrote:and would this work ?

...


I had tried them all expect for the last 2, I think. and actually I think suPHP_ConfigPath /home/account_name/public_html was the trick.

dcz wrote:So what about the php script?

which php script are you talking about? if your talking about the one in viewtopic.php, yes I think that one seems to be working fine - instead of redirecting to a 404 it's redirecting to another page on my site.
Peter77
phpBB SEO Team
phpBB SEO Team
 
Posts: 524
Joined: Wed May 10, 2006 9:46 am
Location: Michigan

Postby dcz » Thu May 25, 2006 5:30 am

So you do have special server settings ;)

I had never seen this one so far, good to know. And I confirm it works well for all urls ;)

GOOD :D

Then, the login thing. I suddenly see something that should no be here in the append_sid function :

Try getting rid of this line, if it appears, in function.php (the phpbb one)

Code: Select all
      $url = preg_replace("'(?)index.php\?c=([0-9]*)'", "".format_url($seo_cat_name)."-vc\\1.html", $url);


It should not mess with login, but, it should not be here as well ;) And the "*" was replaced by "+" (more stricty). This line just stayed there after I decided to get rid of it last time I put it together ;)

Make sure though you have :

Code: Select all
$urlin = array(
         "'(?)index.php\?c=([0-9]+)((&)|(&)){0,1}'",
         //"'(?)sitemaps([0-9]+)\.html((&)|(&)){0,1}'",
      );

      $urlout = array(
         "".format_url($seo_cat_name)."-vc\\1.html".if_query('\\2')."",
         //"".format_url($seo_cat_name)."-sc\\1.html".if_query('\\2')."",
      );
      $url = preg_replace($urlin, $urlout, $url);



right after. You can uncomment the two commented line in this one for the mod rewrite for mx sitemaps to work ;)
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21238
Joined: Fri Apr 28, 2006 9:03 pm

Postby Peter77 » Thu May 25, 2006 6:31 am

dcz wrote:So you do have special server settings ;)

I had never seen this one so far, good to know. And I confirm it works well for all urls ;)

GOOD :D


I know, for a minute there I thought I had a bad server/hosting. 8)

dcz wrote:Then, the login thing. I suddenly see something that should no be here in the append_sid function :

Try getting rid of this line, if it appears, in function.php (the phpbb one)

Code: Select all
      $url = preg_replace("'(?)index.php\?c=([0-9]*)'", "".format_url($seo_cat_name)."-vc\\1.html", $url);


It should not mess with login, but, it should not be here as well ;) And the "*" was replaced by "+" (more stricty). This line just stayed there after I decided to get rid of it last time I put it together ;)

Make sure though you have :

Code: Select all
$urlin = array(
         "'(?)index.php\?c=([0-9]+)((&)|(&)){0,1}'",
         //"'(?)sitemaps([0-9]+)\.html((&)|(&)){0,1}'",
      );

      $urlout = array(
         "".format_url($seo_cat_name)."-vc\\1.html".if_query('\\2')."",
         //"".format_url($seo_cat_name)."-sc\\1.html".if_query('\\2')."",
      );
      $url = preg_replace($urlin, $urlout, $url);



right after. You can uncomment the two commented line in this one for the mod rewrite for mx sitemaps to work ;)


I think maybe you meant sessions.php? well I went a head and did the changes... deleted the line you mentioned. cool, thanks for the info on uncommenting those lines. still have the same problem for login.php ( mxbb ) ... so far it's the last 'problem' that I have. not a big worry... I can temporarly redirect traffic to phpbb's login while I find a fix to that. :)
Peter77
phpBB SEO Team
phpBB SEO Team
 
Posts: 524
Joined: Wed May 10, 2006 9:46 am
Location: Michigan

Postby dcz » Thu May 25, 2006 6:34 am

Peter77 wrote:
I think maybe you meant sessions.php? well I went a head and did the changes... deleted the line you mentioned. cool, thanks for the info on uncommenting those lines. still have the same problem for login.php ( mxbb ) ... so far it's the last 'problem' that I have. not a big worry... I can temporarly redirect traffic to phpbb's login while I find a fix to that. :)


oups, and yes, session.php ;)

look at the other commented lines in the code, I think you should uncomment them all (the one with forum-map and the one for mxbb)

And I think we should stop being that off topic and start a new thread for the other matters ;)

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21238
Joined: Fri Apr 28, 2006 9:03 pm

Postby legal » Wed Jul 19, 2006 9:26 am

Sorry dcz - posting over here now:

.htaccess file in root:


Code: Select all
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.legalitforums\.com$ [NC]
RewriteRule ^(.*) http://www.legalitforums.com/$1 [QSA,L,R=301]
RewriteBase /

#########################################################
# PHPBB SEO REWRITE RULES            #
#########################################################
# AUTHOR : DCZ http://www.phpbb-seo.com/
# STARTED : 01/2006
#####################################################
# FORUMS PAGES
########################
# FORUM PROTECTION RULE
RewriteRule ^.+/([^/]+\.html)$ /index.php [R=301,L]
# CATEGORIES
RewriteRule ^.+-vc([0-9]+)\.html$ /index.php?c=$1 [QSA,L]
# PAGINATED FORUM
RewriteRule ^.+-vf([0-9]+)-([0-9]+)\.html$ /viewforum.php?f=$1&start=$2 [QSA,L]
# FORUM
RewriteRule ^.+-vf([0-9]+)\.html$ /viewforum.php?f=$1 [QSA,L]
# PAGINATED TOPIC
RewriteRule ^topic([0-9]+)-([0-9]+)\.html$ /viewtopic.php?t=$1&start=$2 [QSA,L]
# TOPIC
RewriteRule ^topic([0-9]+)\.html$ /viewtopic.php?t=$1 [QSA,L]
# POST
RewriteRule ^post([0-9]+)\.html$ /viewtopic.php?p=$1 [QSA,L]
#PROFILES
RewriteRule ^member([0-9]+)\.html$ /profile.php?mode=viewprofile&u=$1 [QSA,L]
# END PHPBB PAGES
#####################################################

# phpBB
RewriteRule ^sitemaps.xml$ /sitemap.php [L]
RewriteRule ^forum-sitemap-([0-9]+).xml$ /sitemap.php?fid=$1 [L]
RewriteRule ^sitemap-forum.xml$ /sitemap.php?forum [L]
legal
 
Posts: 42
Joined: Wed Jul 05, 2006 3:22 pm

Postby dcz » Wed Jul 19, 2006 10:14 am

As said, not much more to do than test the several syntax's : http://boards.phpbb-seo.com/seo-techniques/locking-the-www-in-urls-vt30-15.html#228

Just try several until it works, just concern the first two rewriterules, others are not affected ;)

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21238
Joined: Fri Apr 28, 2006 9:03 pm

Postby legal » Wed Jul 19, 2006 10:18 am

Thanks it's worked although for some reason it seems to have blocked access to my stats:

mysite.com/stats

I'll check with my host...
:D
legal
 
Posts: 42
Joined: Wed Jul 05, 2006 3:22 pm

Postby dcz » Wed Jul 19, 2006 10:27 am

All right,

For the stat thing, it's because of the :

Code: Select all
# FORUM PROTECTION RULE
RewriteRule ^.+/([^/]+\.html)$ /index.php [R=301,L]


You need to allowany folder that could host .html files with this.

Change it to :
Code: Select all
# FORUM PROTECTION RULE
RewriteCond  %{REQUEST_URI} !^stats/$
RewriteRule  ^forums/.+/([^/]+\.html)$ /index.php [R=301,L]


And it should work ;)
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21238
Joined: Fri Apr 28, 2006 9:03 pm

Postby legal » Wed Jul 19, 2006 11:31 am

Thanks very much, it did!
:D
legal
 
Posts: 42
Joined: Wed Jul 05, 2006 3:22 pm

PreviousNext

Return to SEO Techniques

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 5 guests