Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
July 24, 2014, 02:43:25 AM

Pages: [1]   Go Down
  Print  
Author Topic: .htacess editing [mod re-write]  (Read 1871 times)
johncccccc
Newbie
*
Offline Offline

Posts: 3


« on: February 19, 2010, 08:51:47 AM »

Hi all

Lets use This site as an example of what Im trying to do to improve Search Engine Spiders/Bots Indexing.

Making a sub-domain for popular boards, for instance this one, then setting up a redirect like "seo.lunarforums.com" as apposed to "http://www.lunarforums.com/index.php?board=15.0"

You can see how the redirect can make the URL much more Search Engine Friendly.

Problem is, When using Cpanel to set up the Subdomain the redirect works perfectly but the real url is not masked, I believe it would need to be masked for the Search Engine to actuall index that Subdomains URL.

The way to do that is by editing the .htaccess file (created by cpanel when setting up subdomain), Thing is no matter what I do, I cant get it to mask, only redirection works.

So lets use this board as an example we want to create a sub-domain (seo.lunarforum.com) and redirect it to "http://www.lunarforums.com/index.php?board=15.0" but we want to mask the URL too

Any Ideas anybody?

Thanks in Advanced! Smile
Logged
MrPhil
Senior Moderator
Berserker Poster
*****
Offline Offline

Posts: 5854



« Reply #1 on: February 19, 2010, 11:22:10 AM »

OK, so you have
http://seo.lunarforums.com
and you want to have that show in the browser address bar, while behind the scenes you are actually going to
http://www.lunarforums.com/index.php?board=15.0?
What does your redirect look like now? Your site produces a link to http://seo.lunarforums.com... what do you do with this fictitious address when it comes in? You may have a problem if you're rewriting from a subdomain (rather than www.lunarforums.com/seo), but if the subdomain actually exists (created through cPanel), it should work. If you do a 302 redirect (not 301), it should preserve the seo.lunarforums.com URL.

My advice is to not use cPanel to do redirection, especially with subdomains and add-on domains. It doesn't handle them well. Manually write your own .htaccess rewrites.
Logged

Visit My Site

E-mail Me
  
-= From the ashes shall rise a sooty tern =-
johncccccc
Newbie
*
Offline Offline

Posts: 3


« Reply #2 on: March 14, 2010, 08:38:26 AM »

OK, so you have
http://seo.lunarforums.com
and you want to have that show in the browser address bar, while behind the scenes you are actually going to
http://www.lunarforums.com/index.php?board=15.0?
Yes exactly Smile
What does your redirect look like now? Your site produces a link to http://seo.lunarforums.com... what do you do with this fictitious address when it comes in? You may have a problem if you're rewriting from a subdomain (rather than www.lunarforums.com/seo), but if the subdomain actually exists (created through cPanel), it should work. If you do a 302 redirect (not 301), it should preserve the seo.lunarforums.com URL.

My advice is to not use cPanel to do redirection, especially with subdomains and add-on domains. It doesn't handle them well. Manually write your own .htaccess rewrites.
OK, So I remove the subdomain from cpanel completely then, then what would I add to create a subdomain and the have it setup like above.
Logged
MrPhil
Senior Moderator
Berserker Poster
*****
Offline Offline

Posts: 5854



« Reply #3 on: March 14, 2010, 10:46:37 AM »

You have to have a subdomain (seo.lunarforums.com) set up, if that's the kind of SEO you want. My advice about not using cPanel to do redirection is that you modify .htaccess yourself, not rely on cPanel to put the right code for you (it will usually break with subdomains and add-ons).

So, if you want seo.lunarforums.com to redirect invisibly to www.lunarforums.com/index.php?board=15.0, you would create an seo subdomain. In its root directory (public_html/seo/) put your .htaccess file with
Code:
RewriteEngine On
RewriteRule .  http://www.lunarforums.com/index.php?board=15.0 [R=302]
This will redirect anything coming into the subdomain back to the main domain at a specific board (but still showing the subdomain in the browser). Make sure that's what you want to do.

Note that if the browser shows "www.lunarforums.com/seo", that's a separate issue. After RewriteEngine On, add
Code:
RewriteRule ^(.*)$  http://seo.lunarforums.com/$1  [R=301]

Finally, don't forget your internal URLs in your forum. For instance, in SMF there is a $boardURL defined in Settings.php, which is the URL to use for internal links. If it's "www.lunarforums.com/", because that's what you want to use for other boards in your forum, that's what visitors using your seo subdomain will see once they click off the main board's page.

You may want to consider using one of the "SEO" or "SEF" mods for a forum, such that it would be www.lunarforums.com/seo rather than using a subdomain. That might be cleaner than using subdomains. Anyway, you should explore the look and feel of several different approaches before you open your forum to the public.
Logged

Visit My Site

E-mail Me
  
-= From the ashes shall rise a sooty tern =-
Pages: [1]   Go Up
  Print  
 
Jump to: