News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

[TIP/TRICK] Making the URLS look pretty =)

Started by desibees, August 06, 2011, 03:32:38 PM

Previous topic - Next topic

desibees

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.



I'm the.. Help abuser


Douglas

Exercise due diligence (and research posting history before actually attempting to make any manual changes to your forums.
Doug Hazard
* Full Stack (Web) Developer for The Catholic Diocese of Richmond
(20+ Diocesan sites, 130+ Church sites & 24 School sites)
* Sports Photographer and Media Personality
* CFB Historian
* Tech Admin for one 1M+ post, one 2M+ post and one 10M+ post sites (last two are powered by multiple servers)
* WordPress Developer (Junkie / Guru / Maven / whatever)

macjive01

Hello, could someone of higher authority and expertise confirm this trick before we newbies relegate our darling websites to error-hood.

Illori

some of them may work, but they really dont have much benefit to your forum.

Advertisement: