views:

129

answers:

2

I want to make my pages search engine friendly and it also looks better that example.com/pageid.php?id=12

I have pages different pages like showUser.php showLocation.php and I want all these to be rewritten.

Wo'nt mod_rewrite slow down my app a little bit?

+3  A: 

You need to take a look at mod_rewrite (providing your host supports it) - here's a good blog post on the subject.

Mark B
Mod rewrite is the way to go if your using Apache. Don't know how to do it on IIS, at least not for free.
JustSmith
would'nt mod_rewrite slow down my app a little bit?
AJ
@Smitch325 This one http://iis.net/extensions/URLRewrite is free, at least. Have not tested it, though.@Ankit Unless you have a zillion rewrite rules, the overhead of using mod_rewrite is pretty negligible. I wouldn't worry about it.
Øystein Riiser Gundersen
+1  A: 

In your particular example, mod_rewrite could be set up something like this:

# .htaccess
RewriteEngine on
RewriteRule ^/([\w-]+)$ /page.php?title=$1

Now, a request to /full-title would resolve to page.php and $_GET['title'] would hold the value 'full-title'.

(Most web frameworks (such as Symfony, Django etc.) allow for customizable URL routing rules which do not require you to hardcode rewrite rules in your .htaccess file.)

Øystein Riiser Gundersen