Page 1 of 1

solved SEO SEF URLs htaccess and ubuntu or wamp

Posted: Tue Mar 22, 2011 10:07 am
by teacherluck
I thought I'd help out, as this seems to be a common problem with very little complete advice, and a lot of bad advice. The Ubuntu docs only get Joomla installed, and don't go as far as enabling SEF URLs. I plan to put this into the docs pages somewhere soon.

Problem: For some people they can rename their htaccess file and click 3 radio buttons to get SEO options working.

For others... It fails. You've made an Ubuntu or WAMP server but the CMS website it's hosting can't use SEF URLs. You've followed the documentation for Joomla (or any CMS) to create SEF URLs, but it's broke. You can even get it working on a a site hosted by godaddy.com or hostgator.com - Perhaps you don't care about SEF URLs and you are trying to use the features of htaccess, yet it's broke.

In the example below I was using Ubuntu and the Joomla CMS installed into a folder called "joomla" with the sample content, and all 3 SEO settings=yes in the global configuration. XAMPP servers seem to have mod_rewwrite working with the default installer. WAMP needs the same fixes as Ubuntu.


errors observed in your web browser:

The server encountered an internal error or misconfiguration and was unable to complete your request
or
The requested URL /joomla/example-pages.html was not found on this server



steps for ubuntu server:
===========================================

1)go to the ubuntu command line

2)type the command: sudo gedit /etc/apache2/sites-available/default

notes: This is the default server configuration file using ubutu server

3) Make 2 changes to the code, see default code below
original: AllowOverride None
new: AllowOverride All

========segment of default code ===================

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

=========code end=======================

4) Save and close gedit


5) type the command: sudo a2enmod rewrite

notes: the ApacheENableModule tool (a2enmod) now enables the "rewrite" module for good. The next time you reboot, the module loads automatically

6) type this command: sudo /etc/init.d/apache2 restart

notes: this restarts the apache2 web server without rebooting your pc



7) test that .htaccess files are being loaded properly by apache

type the command: sudo mkdir /var/www/foofolder
type the command: sudo gedit /var/www/foofolder/.htaccess

in the file add these 2 lines below
Options +FollowSymLinks
Redirect /foofolder/foo.html http://www.google.com

Save and close gedit

8) Open a browser and test your server URL by adding foofolder/foo.htm

example url: localhost/foofolder/foo.html
result, you should see google

9) Follow the steps for SEF Urls in your docs for your CMS website
SEF = Search Engine Friendly
(the opposite of long URL's with querry strings)

10) For the Joomla CMS you would rename the default file
from: htaccess.txt
to: .htaccess
and set all 3 SEO settings to "yes" in the Joomla back end, global configuration

ubuntu command line: sudo mv /var/www/joomla/htaccess.txt /var/www/joomla/.htaccess

11) Done


Steps for a Wamp Server
===============================
use notepad to edit the file
c:\wamp\bin\apache2.2.11\config\httpd.conf

Your folder may have a different apache version

search for the text "rewrite"
remove the pound symbol # - at the start of that line of text

search for the text "None"
change it to "All" in both places as noted in step 3 above

save and exit notepad

click start, run, cmd.exe
type the commands
c:
cd\
cd wamp
cd www
cd joomla
rename htaccess.txt .htaccess

use the mouse to click the wamp menu stop all, then start all

Re: solved SEO SEF URLs htaccess and ubuntu or wamp

Posted: Mon Sep 19, 2011 1:33 pm
by sudeep
Thanks a lot. I have been on my test server with non-SEO URL friendly since an year. Your article is really helpful as now I can develop my components with SEO friendly URL

Re: solved SEO SEF URLs htaccess and ubuntu or wamp

Posted: Fri Sep 23, 2011 1:00 am
by teacherluck
THanks. For Ubuntu you only need to do steps 1-5 and then reboot.

Steps 6-11 verify you've done the fix completely.

Re: solved SEO SEF URLs htaccess and ubuntu or wamp

Posted: Wed Oct 09, 2013 4:22 pm
by IMspintheweb
Excellent find!

Thanks for posting

Re: solved SEO SEF URLs htaccess and ubuntu or wamp

Posted: Thu Dec 26, 2013 10:33 am
by enbees
Thanks alot!! I've been looking for this for my WAMP server at the local computer for so long. Great Job.

Re: solved SEO SEF URLs htaccess and ubuntu or wamp

Posted: Sun Jun 28, 2015 6:01 am
by sophiesowmy
Thanks alot... used to setup server conf in local... working fine,