How to remove /pg/ or /mod/ from URL?

What i want is URL should be easy, user friendly and SEO friendly.

I want to change url from


i mean i want to remove that /pg/ or /mod/ from the url.

I have seen this at some places which says it is possible through mod_rewrite if yes please let me know how can i do that in Elgg?

  • There are two issues that need to be understood here:

    1. Elgg;

    2. SEO and indexing.

    Ultimately, the 'pg' and 'mod' parts of the URL should not affect your SEO as Kevin rightfully stated above. Here's why:

    First, commonly, the 'pg' in the url is thrown in the url when you are logged on and are accessing a portion of the site where the information displayed are displayed because you are logged in. Example: if you want to look at your pages, the url will contain the 'pg', while if you go to all site pages, the url will contain 'mod' instead.

    Secondly, think of 'pg' as a non-existant url element, the important part is the 'mod'. It is the mod where the major portion of the site's content is dealt with and processed. Furthermore, 'mod' is a real existing directory on your server where your plugins like messages, pages, groups..etc reside. And for SEO, that's what matter, specially for crawling and indexing.

    Therefore, regardless whether you have the pg or not, you shouldn't worry about it affecting SEO, because what you see in your address bar (with 'pg' in it) may not be the same url I see when we are both looking at the same page, this is because you are logged in and I might not be, or, you might be logged in looking at one of your pages, while I am logged in looking at a page where I was taken from a site search.

    Search engines like the idea of short direct url. Yes. But, that doesn't mean they don't go crawling and scowring all directories. As matter of fact, intelligent search engines like Google prefer to index a page based on the content with very little consideration to the page url.

    I would strongly suggest that if you want to be a perfectionist with your SEO, focus less on url's and consentrate more on the page content and title. Search engines are clever enough nowadays to crawl, index and list page with multi-level url's.

  • I convert most of the stuff to use page handlers -pg addressing-, for better url hierarchy, and to hide the directory structure. Another reason is 'mod' in the URL doesn't give me a good impression as a visitor, it feels like I'm navigating on a bunch of mods, and not a single, compact website. I know, it's just an impression.

    A sitewide replace for two usage of 'pg' addressing solves the hardcoded 'pg's. Then it's just about inserting an entry line into the .htaccess file for every mod, instead of a single 'pg' line. And you have nice URLs.

    If I were to release it, I would give mods a property to define their page handler, and the core would add the necessary URL rewrite rule automatically, resulting better URLs, better structure for mod developers.


  • Darkwing, brilliant post.  ...Just remember everyone, it's not always in the interest of the developers to have such pretty links.  It becomes less obvious what the product is.  ;-)  ...So, I would not expect help from the higher-ups on this.  That's why you'll get responses like one early in this thread.

    As for dealing with pg, there are other alternatives.  You could do a find and replace to make it more integrated into your site.  The pg, as far as I see it, applies more to your users content.  So, if you had a social network for a certain nitch, you could rename pg to something applicable, like 'student' for a students social networking site.  This is, of course, if you don't want to handle it through mod_rewrite.  ...Jeroen already has a plugin to handle the mod_rewrite and so do others.

    @Dhrup, stop making posts if you are just going to delete them and ruin the continuity of threads.  You make idiotic comments that you are forced to just delete later because you end-up looking like an idiot, yet again.  So, just stop getting involved everywhere and maybe you will be more productive on the site.

  • of course if anyone of you had bothered yourself to look around you would have noticed that Vasco does a plugin that tidies up the url in that way.

  • @darkwing.. Looking at a URL may give you an impression that the site is a bunch of blocks put together in mods.. yes, I too get that impression when I look at URL's that contain 'mod', or, as in other scripts, the actual mod name like 'messages, blogs..etc. But, for the common user, that really is not an issue. You probably agree. But yes, if you decide that you want more compact url's, then of course dealing with the 'pg' hadcode, and making the entry in .htaccess is more than sufficient to fix it, but it is still a matter of personal preference. Honestly, if I was to deal with the url's on my site, I would apply your fix since I like writing the code and less inclined to deploy too many plugins.

    @all.. the initial post in here was a bout whether the longer url would affect SEO.. I guess tha nswer is 'No'... whether shorter url's are better, well, it's a matter of choice.


  • @jededitor, I am aware of Vasco's plugin; I didn't automatically want to give an advertisment for a paid plugin, however.  So, you assume we did not bother to look around.  You are wrong and arrogant to think so.  Maybe people are trying to work out a free solution, here on the community?  Give me a break.

  • @yakiv - All you ever do is complain about something that is free so don't expect a break..

  • @jededitor, I do not complain about Elgg. I complain about certain idiots on the Elgg community.  ;-)