Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

How do I show titles of the page in URLs?

Currently: http://websitename.com/index.php?c_id=18&start=0&m_id=1

Change To: http://websitename.com/index.php?c_id=title_of_the_page&start=0&m_id=1

Like Joomla gives us option to change URLs to seo-friendly, is there a code or something we do in httaccess etc so the page title automatically becomes part of the URL?

share|improve this question
    
Why not use WordPress which is excellent SEO capabilities built in or Yoast SEO which make it even better? –  Anagio Apr 30 '12 at 11:03

3 Answers 3

Your question has different answers for different versions of Joomla. First I recommend on reading this.

I work with Joomla 1.5 in the following manner:
http://yourdomain.com/index.php/[menu-alias]/[category-id]-[section-alias]/[article-id]-[article-alias]

but I think it's a better practice to get rid of the "index.php" part of the URL (I didn't have time to implement it in my own website). That said, you don't have to "do it yourself" - as you can use plugins such as this one.

share|improve this answer

As you're using the title could be anything, and isn't really known until the page id displayed, by which time the URL has been used.

So this only works if you know the code used to generate the title in the PHP file. You could use similar code to that to generate the htaccess rules which convert the cryptic URL to a URL with the title in it.

share|improve this answer

Yes, what you're looking for is the Mod_rewrite module for apache2. You may well already have this modules active on your server especially if your using a shared hosting package.

http://httpd.apache.org/docs/current/mod/mod_rewrite.html explaines its usage.

In essance, you place your 'url rules' in your .htaccess file in your web root.

For example, a .htaccess file might contain:

RewriteEngine On RewriteRule ^index.html$ newsite.html

would direct a index.htlm request to newsite.html.

share|improve this answer
    
note- your main apache2 config file should contain the "AllowOveride" directive in order for you to use .htaccess files. –  user885983 Apr 30 '12 at 11:27
    
What's the rule to examine the contents of the page to extract the title tag and change the URL? The questioner is asking a very specific question, not a general question about rewriting URLs. –  paulmorriss Apr 30 '12 at 13:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.