Connect with Expertise | Find Experts, Get Answers, Share Insights

how to make seo friendly URLs using .htaccess

 
Join Date: Mar 2010
Posts: 3
#1: Mar 17 '10
I'd like to take the following URL:

http://www.website.com/index.php?url=about-us

and turn it into : http://www.website.com/about-us

and aso http://www.website.com/about-us.php

I have read / seen many tutorials, but none of them seems to work.

Atli's Avatar
E
M
C
 
Join Date: Nov 2006
Location: Iceland
Posts: 4,618
#2: Mar 17 '10

re: how to make seo friendly URLs using .htaccess


Moved to the Apache forums.
Atli's Avatar
E
M
C
 
Join Date: Nov 2006
Location: Iceland
Posts: 4,618
#3: Mar 17 '10

re: how to make seo friendly URLs using .htaccess


Hey.

The module used to do that is called mod_rewrite. It re-routes incoming requests based on regular expression patterns.

This tutorial explains it pretty well.
- http://articles.sitepoint.com/articl...rl-rewriting/2

You will also need to know the basics about regular expressions if you plan to use mod_rewrite. This site is one of the best regular expression resources out there.
- http://www.regular-expressions.info/tutorial.html
 
Join Date: Mar 2010
Posts: 3
#4: Mar 18 '10

re: how to make seo friendly URLs using .htaccess


Thank you,

But again, they are keeping products.php as base..., and it didn't help me......

Please, if you know it, just give me the code to accomplish this....., that's all i need.

Again thanks for those links, they are really useful..
 
Join Date: Mar 2010
Posts: 3
#5: Mar 20 '10

re: how to make seo friendly URLs using .htaccess


I am still waiting for the answer, please help... :)
Atli's Avatar
E
M
C
 
Join Date: Nov 2006
Location: Iceland
Posts: 4,618
#6: Mar 20 '10

re: how to make seo friendly URLs using .htaccess


@dhruvjha
We don't do that. We are here to help you create code, not to do it for you.
Post what you have tried, and I will help you make it work.

I'll help you get started, though. This regular expression will match either of the URLs you want to match.
Expand|Select|Wrap|Line Numbers
  1. ^about-us(\.php)?$
With that, and a basic understanding of how mod_rewrite works (which you can get by reading the tutorial I posted), you should have no problem creating the rewrite rule you need.
Reply

Tags
htaccess, seo, seo friendly urls