Need Help for directory base SEO Url in htaccess

  • gdhanasekar
  • Beginner
  • Beginner
  • User avatar
  • Posts: 50

Post 3+ Months Ago


I am implementing the seo url in my site.The seo url is like directory based url, for example


By using

RewriteRule index/module/(.*)/content/(.*)/type/(.*)/id/(.*)/ index.php?module=$1&content=$2&type=$3&id=$4

this is working fine,but I have to do this for each and every page of my site to generate seo urls.

Is there any other ways to implement the above directory like seo url using simple method?

Just I want all the GET parameters in my url instead of &,=
  • Truce
  • Guru
  • Guru
  • Truce
  • Posts: 1469
  • Loc: Washington DC

Post 3+ Months Ago

You can certainly write more complex rewrite rules (and rewrite conditions) and structure your website to handle everything better, but it really depends on how you have everything setup.

By the way, you don't need to have 'module', 'content', 'type', or 'id' in your urls so long as the values are always in the same order and always filled in.

Code: [ Select ][id]/[title]

RewriteRule ^page/([0-9]+)/([a-zA-Z0-9_-])+/?$ /page.php?id=$1&title=$2
RewriteRule ^forums?/([0-9]+)/([0-9]+)/.* /forums/index.php?forum=$1&thread=$2
  2. -->[id]&title=[title]
  4. -->[forumid]&thread=[threadid]
  5. RewriteRule ^page/([0-9]+)/([a-zA-Z0-9_-])+/?$ /page.php?id=$1&title=$2
  6. RewriteRule ^forums?/([0-9]+)/([0-9]+)/.* /forums/index.php?forum=$1&thread=$2

Note that in the last rewriterule I added a question mark after the forums part. That means it will allow forum/... or forums/... and handle it the same. Doing what users expect is a big user-interface perk!

I hope that helps answer your question.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 45 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.