ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

remove Category URL Indicator name?

July 26, 2008 3:06am

Subscribe [8]
  • #1 / Jul 26, 2008 3:06am

    bmovie

    619 posts

    hi, I almost done with my wish url, I need remove the Category URL Indicator name called “category”:

    I have this:
    http://www.mysite.com/index.php/entertaiment/category/music

    I remove the index.php and have this:
    http://www.mysite.com/entertaiment/category/music

    now I need remove “category” for get this final url:
    http://www.mysite.com/entertaiment/music

    how I can remove that?
    thanks 😊

  • #2 / Jul 26, 2008 4:12am

    Ingmar

    29245 posts

    You can’t do that, unless you use Cxx categories, like http://example.com/entertaiment/C12.

  • #3 / Jul 26, 2008 4:21am

    bmovie

    619 posts

    definely I cant? Cxx its more ugly that a name, but I need remove the entire name, with the parameter backspace=“6” it not possible, remove 6 characters? maybe I confuse with funtionally of that parameter…  mmm

    you know looks better and more simple to remember to users remember this: http://www.mysite.com/entertaiment/music and not http://www.mysite.com/entertaiment/category/music

    thanks

  • #4 / Jul 26, 2008 5:14am

    Ingmar

    29245 posts

    No, you can’t. Not easily, at any rate: some PHP, and perhaps querying the data directly from the db would get you there, I suppose, but out of the box, you can’t do it. And, no, the backspace parameter doesn’t do this.

    I don’t think it’s much of an issue, very few users (if any) are going to type in the link to a category by hand, and your internal links, as well as Google & Co., won’t care.

    That said, you can always rename “category” to something better suited for your site.

  • #5 / Jul 26, 2008 11:45pm

    bmovie

    619 posts

    thanks Ingmar, well you have a reason that is not a big issue… so I think in better names… “tag” sounds good I think, any other name suggestions? for no use category? 😊

  • #6 / Jul 27, 2008 7:39am

    Cocoaholic

    445 posts

    You could grab the segment containing the category_url_title, use a quick query to fetch the category ID, and use that as a parameter for your weblog tag.

    Your URL would look like this (without the “Category URL Indicator”) so make sure your links also lose the indicator.

    <a href="http://www.mysite.com/index.php/entertaiment/music/">http://www.mysite.com/index.php/entertaiment/music/</a>

    your category_url_title would be segment_2:

    {exp:query sql="SELECT cat_id FROM exp_categories WHERE cat_url_title = '{segment_2}'"}
    
    {exp:weblog:entries weblog="your_weblog" category="{cat_id}"}
    ...
    {/exp:weblog:entries}
    
    {/exp:query}

    Let me know if you need more help.

  • #7 / Jul 27, 2008 10:42am

    Derek Jones

    7561 posts

    True, Cocoaholic, but certain tags would not recognize that you are on a category page, like the Category Heading tag.

  • #8 / Jul 27, 2008 10:49am

    Cocoaholic

    445 posts

    Indeed, but you can easily fetch it with the same query and add it, right?

    {exp:query sql="SELECT cat_id, cat_name FROM exp_categories WHERE cat_url_title = '{segment_2}'"}
    
    <h2>{cat_name}</h2>
    
    <p>{exp:weblog:entries weblog="your_weblog" category="{cat_id}"}<br />
    ...<br />
    {/exp:weblog:entries}</p>
    
    <p>{/exp:query}

    Or am I missing the point?

  • #9 / Jul 27, 2008 4:45pm

    Derek Jones

    7561 posts

    No, just that certain tags will not work as intended.

  • #10 / Dec 22, 2008 5:55am

    sthmtc

    11 posts

    I just found out that if you use a dot (’.’) as category indicator name, the ‘category’ URL segment is completely hidden from the URL. So it would be /entertainment/music in your particular case.

  • #11 / Dec 22, 2008 6:10am

    Ingmar

    29245 posts

    This is certainly not a recommended method. I’ll try this myself, but would quite frankly be surprised if there were no ill side effects.

  • #12 / Dec 22, 2008 9:19am

    sthmtc

    11 posts

    This is certainly not a recommended method. I’ll try this myself, but would quite frankly be surprised if there were no ill side effects.

    I was quite surprised that this works in the first place. However, I haven’t come across any side effects yet—and I’ve almost finished building the website. Coming from Textpattern, I’m missing the possibility to fine tune your URLs very much, so I was happy to find such a workaround.

  • #13 / Jan 24, 2009 2:25am

    sosolatin

    10 posts

    would be good to see an example of this? maybe a code snippet?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases