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.

Pass Weblog entry into second url segment

May 17, 2010 1:30pm

Subscribe [3]
  • #1 / May 17, 2010 1:30pm

    Joe Wolin

    206 posts

    I’d really like to have a very short url on one section of my site.  Preferrably something like the following:

    mysite.com/my-weblog-entry

    I’ve attempted to check the first url segment in my index template but ee is looking for the template group before checking the segment - resulting in a 404 since the first segment is a weblog entry, not a valid template group.

    Is there any way I can get this sort of structure on my site?

  • #2 / May 17, 2010 2:18pm

    Vaughn E

    2 posts

    Interesting requirement. Easy enough to do for specific templates/pages but can’t think of a way to do it for dynamic entries. Interested to see if someone has a solution.

  • #3 / May 17, 2010 2:27pm

    Wouter Vervloet

    758 posts

    You could mess around a bit with a .htaccess file and internally redirect it to a specific group/template.

    RewriteEngine on
    
    RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d
    
    RewriteRule ^(.*)$ /index.php/group/template/$1 [L]

    Of course this will need to be edited to account for your other pages (if you have any) since this will redirect all the requests to that specific template (direct file/directory access excluded).

    Greetz,
    Wouter

  • #4 / May 17, 2010 3:50pm

    Joe Wolin

    206 posts

    Thanks Wouter, I’m going to give your idea a try.

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

ExpressionEngine News!

#eecms, #events, #releases