It’s common tendency for Search Engine Optimization specialists to avoid use of dynamic URLs and not groundlessness. Search Engine Spiders don’t index URLs overwhelmed with dynamic parameters.
So if your site is PHP-based and resides on an Apache Server then you might consider carrying out these four simple steps to boost your traffic:
1. Identify the file that needs to be changed and the variables that generate a common page. (commonly “index.php”).
2. Place a text file .htaccess in the directory where, “index.php,” is located on the server.
Specify variables you want to be static to the server: change “?category=1” variable to “directory-1.html”.
3. Create a rewrite engine in the .htaccess file. Put first line to read, “RewriteEngine On”. Specify Rewrite rule on the next line: “RewriteRule ^directory-([0-9]*).* index.php?category=$1 [L,NC],”.
4. In the PHP file replace “index.php?category=,” to read, “directory-,” where, “index.php?category=X,” is found and follow behind the variable (x) with, “.html”.

5 Comments
KesheR
on 12th May, 06 05:05am
mmmmmm… interesting, thanks
Sam Stevens
on 12th May, 06 08:05am
While it may have been implied, it would also be good to mention that “directory-1.html” could be further optimized by using a keyword or two in the file name, eg. “blue-widgets.html”.
Nate K
on 15th May, 06 07:05am
This is a very good beginning point to creating SEF URLS. There are also several other options, depending on the language you are using to create these urls.
I use this approach on every site I create for several reasons:
1. Its very flexible.
2. Though flexible, its very strict and secure. If the URL does not match the regex, then it gets a 404. This is a good front to validate and protect against query string injection.
3. Control of the request/routing. I can specify 301/302 and even 404 if necessary and then point them accordingly.
4. Mapping URLS. I have re-build several sites and am able to re-route the old indexed URLS with a 302 to let search engines know the page has moved. This helps for those who have pages bookmarked or search engines who have pages cached. I can also map a page with two different patterns. IE (www.barbourbooks.com). The book detail page can be accessed with its title friendly URL, or by putting in the ISBN of the book directly (though they must match valid ISBNs, as well as be in our stock).
5. Programming language doesnt matter with this approach. I can map some pages to PHP, ASP, CFM, JSP, etc – or whatever I want (if you so choose) and not have to change the url structure or extensions. So a system switch from one programming language to another will not be affected.
Nice read!
Peace,
Nate
Lukas Labryszewski
on 15th May, 06 12:05pm
I do something like this in my .htaccess file:
I commented it for clarification.
This way I have full control over Search Engine Friendly URLs in my PHP and can do whatever I need dynamically, instead of modifying .htaccess every time I need to add a module. main.php is my controller.
RewriteEngine On
# If the requested local file path is !NOT a regular file (-f) in the file system
RewriteCond %{REQUEST_FILENAME} !-f
# If the requested local file path is !NOT a directory (-d) in the file system
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite Any string with 0 characters or more and replace it with index.php
RewriteRule ^(.*) main.php [PT]
Visitor327
on 24th Oct, 07 01:10pm
I have visited your site 344-times