Keep your domain simple with PHP

Saturday, April 5th, 2008 | Tech Corner with

Most of us bloggers use WordPress, but our actual domain name may look like this www.yourdomain.com/wordpress or if you’re using a sub-domain it looks like myblog.yourdomainname.com.

There’s a downside to this if you ever stop using WordPress or any other blog application. All that work to create traffic is lost because your domain can’t be found as it’s pointing to the ww.yourdomain.com/wordpress. You will also have to change your domain name (url) with all the various social networks, ad campaigns that you registered with.

How would you like to just keep it simple? You can! You can just use www.yourdomainname.com without adding any additional pages to your domain name by using a small PHP script.

Instructions:

1. Create an index.php page using notepad and just name it index.php

2. Place the code below and edit the path where your WordPress is located. In most cases it’s www.yourdomainname.com/wordpress.

3. Upload your index.php into the root directory (html or www) and not the WordPress directory using your favorite FTP client.

<?php
header(”Location: http://www.yourdomainname.com/wordpress/”);
?>

Now you can go back to just using your original domain name. This script is a re-direct to your actual www.yourdomainname.com/wordpress. You will not notice the re-direct at all. I have used this since day one with my WordPress blog.

[del.icio.us] [Digg] [Google] [Reddit] [StumbleUpon] [Technorati] [Email]

Comments

  1. 1
    Young Online Millionaire // April 5th, 2008 at 11:23 am

    Good tip, very useful for SEO as well.

  2. 2
    Sebastiano // April 5th, 2008 at 11:53 am

    good tip, but I think it is more effective using .htaccess to do direct redirections, I prefer using your way inside scripts like forms,to prevent re-post on page reload..

  3. 3
    blogzilla // April 5th, 2008 at 12:08 pm

    Sebastiano,

    The php method is amongst a few, but it really works well.

  4. 4
    Richard // April 5th, 2008 at 12:25 pm

    Hey, nice article. I totally agree, keeping your domain simple is very very important, and having a short domain is also helpful. Unfortunately for my website, I couldn`t find a shorter name lol.

    Oh btw, you put “ww.yourdomain.com/wordpress”, might want to add another w.

    And hey, I haven`t tried the google pagerank prediction yet, but that looks pretty cool. And what will it take to get on your blogroll?

  5. 5
    Richard // April 5th, 2008 at 12:27 pm

    Hrm, that pagerank prediction doesn`t seem to work. I tried a few sites, and it keeps telling me that you need a minimum of 100 backlinks, I`m pretty sure the sites I entered have 100 backlinks…

  6. 6
    Jonathon // April 5th, 2008 at 1:36 pm

    Definitely a nice and useful article. This could help save some people a lot of time and hassle if they stop using Wordpress.

  7. 7
    TheCuso Magician // April 5th, 2008 at 2:53 pm

    im here for the stumble :P, nice site, added to faves

    if you want to stumble… thecuso.info (magic,poker) ;)

    thanks!

  8. 8
    Ty Hurd // April 5th, 2008 at 2:53 pm

    Richard, go to https://siteexplorer.search.yahoo.com and you can do a search of backlinks on any URL.

  9. 9
    blogzilla // April 5th, 2008 at 2:56 pm

    Thanks for sharing Ty.

    TheCuso,

    Thank you for visiting and you been SU’d!

  10. 10
    Jennifer // April 5th, 2008 at 4:09 pm

    Great advice. I use blogger and I am concerned that if I ever want to change that I will have to change names because of the blogspot at the end of my name.

  11. 11
    Josh // April 5th, 2008 at 4:16 pm

    gotta love .htaccess

  12. 12
    Josh // April 5th, 2008 at 4:18 pm

    Also, way to smash into the 88k on Alexa

  13. 13
    blogzilla // April 5th, 2008 at 4:19 pm

    Josh,

    There’s always a few ways. This is an easier way for the novice until they understand. Thanks man, I am feeling 83K :)

  14. 14
    yearblook // April 5th, 2008 at 5:03 pm

    A very easy hack to get the job done quickly.

    Wordpress will also re-write .htaccess files for you so it would be worth playing around with the settings there to see if you can move http://www.mydomain.com/wordpress to http://www.mydomain.com.

    Ted

  15. 15
    Fool // April 5th, 2008 at 6:11 pm

    Thank you for this, I was scratching whats left of my hair out.

  16. 16
    blogzilla // April 5th, 2008 at 6:47 pm

    Hey fool,

    Glad you can walk away with some knowledge.

  17. 17
    Nick Throlson // April 6th, 2008 at 2:26 am

    Nice post i agree with ya if u ever change your site from a sub domain or domain.com/wordpress/ your will lose alot of your traffic but you could gain it back if u know a little about seo ~Nick~

  18. 18
    Si Philp // April 6th, 2008 at 5:25 am

    I use wordpress on the root of my podcast site as I try to keep my urls to a decent size :)

  19. 19
    Haspel // April 6th, 2008 at 11:04 am

    Nice tip.Finally something that I can do by myself :)

  20. 20
    MindBlogger // April 7th, 2008 at 4:22 am

    Right on! I use this technique to redirect affiliate links. I sometimes find that people are a bit uptight about clicking on a link with scary looking numbers and letters so that, it’s an effective way of preventing that from happening.

    Cheers!

  21. 21
    Torchwood Studio // April 8th, 2008 at 2:22 am

    Great tip! I’m using TypePad right now and I’m wondering if I can use the hack for the same results. Well, off to try it and see what happans!

  22. 22
    Nick Throlson // April 14th, 2008 at 8:02 pm

    Thanks for the tip also good for SEO ~Nick~

Leave a Comment