Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: desibees on August 06, 2011, 03:32:38 PM

Title: [TIP/TRICK] Making the URLS look pretty =)
Post by: desibees on August 06, 2011, 03:32:38 PM
hey SMF,

This is my first tutorial ever on this site. There are many of you that have helped me a lot so I decided to do a favor for some of you in return. In this tip/trick, I will be telling you how to make your URLS look pretty - my first priority when I installed the forum. From my personal experience and research, many of you are having problems with this, which also ends up to forum crashing.

1. Removing Index.php from Homepage only!

This will turn your URL from www.mysite.com/index.php to www.mysite.com. This is helpful because it removes it from the homepage only, therefore the rest of the forum will still work fine on all browsers.

Steps.
1. Go to your file manager, root folder and Edit: .htaccess
2. If the file is empty/or you created a new one, add the following code:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^\/index.php$
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)$ / [L,R=301]

If the following file already has "RewriteEngine On" written in, then add the last 3 lines after it.
3. Simply save the file and try it out.

2. Adding www. in front of the URL without breaking any pages
1. Log in to your site, go to Admin>Configuration>Server Settings>Database and Paths>Forum URL
2. If it says mysite.com, simply change it to www.mysite.com
^^ You are not done yet, doing this will break pages and cause many errors.
3. Go back to .htaccess, and add the following code under RewriteEngine On
RewriteCond %{HTTP_HOST} ^mysite.com\.net$ [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301]

Make sure you change "mysite.com" to your forum URL - or else this will not work.
4. Save the file and try it out.

3. Making URL look prettier.
1. For this, you could install Pretty URLS, SimpleSEO or any alternative mod and this is what it will do:
    http://domain.com/board/topic/
    http://domain.com/profile/user/
    http://domain.com/unreadreplies/
^ Note, this will automaticly edit .htaccess for you, so you don't have to worry.

Good luck.

Title: Re: [TIP/TRICK] Making the URLS look pretty =)
Post by: Douglas on August 06, 2011, 11:24:57 PM
Exercise due diligence (and research posting history before actually attempting to make any manual changes to your forums.
Title: Re: [TIP/TRICK] Making the URLS look pretty =)
Post by: macjive01 on August 20, 2011, 04:38:40 AM
Hello, could someone of higher authority and expertise confirm this trick before we newbies relegate our darling websites to error-hood.
Title: Re: [TIP/TRICK] Making the URLS look pretty =)
Post by: Illori on August 20, 2011, 06:51:25 AM
some of them may work, but they really dont have much benefit to your forum.