Jump to content



Recommended Posts

Hey, I'm wondering how to go about creating and using these types of URLs. I'm presuming it's PHP that does this? I see them on Wordpress and Joomla and such but I've been trying to learn exactly how to create these types of URLs. Does anyone have an article or tutorial to start off to get going? Thanks.

Link to comment
Share on other sites

Thing about that is your web application need to have a "seo url" slug, stored in the database  alongside the ID.

The slug is a formated version of the title of your page, so say your page is.

"Foo widget and Acme Widgets"  , the seo version would be  "foo-widget-acme-widgets" , that would be stored in the DB too.

When you create your pages, you take the seo url slug and put into the links on your site programmatically.




.htaccess grabs the "foo-widget-acme-widgets", sends it to the article.php file,  article.php?page=foo-widget-acme-widgets , "foo-widget-acme-widgets" is sent into the db and to retrieve the content where the row has "foo-widget-acme-widgets".

Link to comment
Share on other sites

btw if you dont have a seo url slug, sometimes in a web application a design change like that might be too late.

You can use just the auto-incrementing ID of the row that the article, product or whatever is in.

So instead of




You could do this.


/article/10    .htaccess just grabs the "10" and does the same thing, sends it to your script and your script finds the row where id is 10.

Link to comment
Share on other sites

mod rewrite for htaccess no database entry needed

simply code your links as html links and let htaccess convert them to the real pages for your applications

eg htaccess

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^([^/-]+).html$ /$1.php [R=301,L]


so you would make your link products.html for example and that htaccess will convert that to product.php, it is also possible to pass variables to the pages with this method aswell.

Link to comment
Share on other sites

mod rewrite for htaccess no database entry needed


Well you do and you dont, take this for example,




The /body-lotions-s/  is made probably programmtically, the 47 is the ID in the table, but that generates a bad problem, since /body-lotions-s/ is not actually checked in the db along with id, You can do this


hxxp://www.iwantthathair.com/lollolololololollolololololololololol-s/47.htm  (not linked so a search bot doesn't follow this)


Malicious things can happen, if someone can generate infinite urls to a page.

For example I could generat all kinds of urls to pointing your page, then spam them everywhere and you get your site penalized for duplicate content.

Link to comment
Share on other sites

more page specific rules can be made that was a general example likewise:-


1 variable

RewriteRule ^catalog-([^/-]+).html$ /catalogs.php?colID=$1 [NC]


2 variables

RewriteRule ^products-([^/-]+)-([^/-]+).html$ /products.php?ID=$1&catID=$2 [NC]


and so on

Link to comment
Share on other sites

  • 3 weeks later...

I can't seem to get it working. I was following the tutorial and I got into the http.conf and was able to

#LoadModule rewrite_module modules/mod_rewrite.so


remove the # but I couldn't find the #AddModule, but I tried restarting my apache anyway and went on with the tutorial but not working so I figured that was majorly important.

Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.