Google Groups Home
Help | Sign in
Routing with and without slashes at the end of the url
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Joan Piedra  
View profile
 More options Jan 26, 11:54 am
From: "Joan Piedra" <d.ne...@gmail.com>
Date: Sat, 26 Jan 2008 11:54:14 -0500
Local: Sat, Jan 26 2008 11:54 am
Subject: Routing with and without slashes at the end of the url

Good morning symfoners,I've been looking for an answers to this but I'm
afraid I couldn't find any.

Symfony routing usually works like this, adding modules and actions without
a final slash in the url.
/:module/:action
/:module

Therefore, I could get to a simple routing just like this.
/post/create
/post

So far so good, until the final user decide to write a direct url in the
browser with a final slash, just like this.
/post/create/
/post/

If this happens they would get a plain 404 error, I do know about content
repeating is banned from Google, but we could just use a simple 302 redirect
to make this work hassle free.

/post/create/ would redirect to /post/create and the users could get to the
action, as simple as that.
Is it possible to make this work, if so how?

Have a nice weekend to you all.

Thanks,
My best regards.

--
Joan Piedra  ||  Frontend web developer
http://www.justaquit.com/  ||  http://www.joanpiedra.com/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James  
View profile
 More options Jan 26, 12:23 pm
From: James <thenet...@gmail.com>
Date: Sat, 26 Jan 2008 12:23:53 -0500
Local: Sat, Jan 26 2008 12:23 pm
Subject: Re: [symfony-users] Routing with and without slashes at the end of the url

I just created a 2nd route with the / at the end, but you are probably  
right this should be handled automatically by symfony.

James

On Jan 26, 2008, at 11:54 AM, Joan Piedra wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Yılmaz Uğurlu  
View profile
 More options Jan 26, 2:48 pm
From: "Yılmaz Uğurlu" <yilugu...@gmail.com>
Date: Sat, 26 Jan 2008 21:48:16 +0200
Local: Sat, Jan 26 2008 2:48 pm
Subject: Re: [symfony-users] Re: Routing with and without slashes at the end of the url

Hi, i am using like this

post_detail:
  url: /blog/:stripped_category_title/detail/:stripped_title/*
  param: { module: blog, action: detail }

and it is work good for me both "/blog/lab/detail/stripped-title"  and
"/blog/lab/detail/stripped-title/"

2008/1/26, James <thenet...@gmail.com>:

--
Yılmaz Uğurlu ~ jabber : metoi...@jabber.org  ~ http://www.2nci.com ~ İzmir

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jonathan Franks  
View profile
 More options Jan 26, 2:58 pm
From: Jonathan Franks <jonat...@ifranks.com>
Date: Sat, 26 Jan 2008 19:58:04 +0000
Local: Sat, Jan 26 2008 2:58 pm
Subject: Re: [symfony-users] Re: Routing with and without slashes at the end of the url
you can use .htaccess to remove trailing slashes from urls. Just google
it, there are plenty of examples online....


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joan Piedra  
View profile
 More options Jan 27, 1:15 am
From: "Joan Piedra" <d.ne...@gmail.com>
Date: Sun, 27 Jan 2008 01:15:47 -0500
Local: Sun, Jan 27 2008 1:15 am
Subject: Re: [symfony-users] Re: Routing with and without slashes at the end of the url

Jonathan you were completly right.I just added an htacces condition and rule
to make this 301 redirect work.

I will send a blog post about this soon.
Thanks for pointing it out.

On Jan 26, 2008 2:58 PM, Jonathan Franks <jonat...@ifranks.com> wrote:

--
Joan Piedra  ||  Frontend web developer
http://www.justaquit.com/  ||  http://www.joanpiedra.com/

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James  
View profile
 More options Jan 27, 1:23 am
From: James <thenet...@gmail.com>
Date: Sun, 27 Jan 2008 01:23:50 -0500
Local: Sun, Jan 27 2008 1:23 am
Subject: Re: [symfony-users] Re: Routing with and without slashes at the end of the url

can you send what you used?  I'd like to do the same.

thanks,
James

On Jan 27, 2008, at 1:15 AM, Joan Piedra wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joan Piedra  
View profile
 More options Jan 27, 2:44 am
From: "Joan Piedra" <d.ne...@gmail.com>
Date: Sun, 27 Jan 2008 02:44:41 -0500
Local: Sun, Jan 27 2008 2:44 am
Subject: Re: [symfony-users] Re: Routing with and without slashes at the end of the url

James,
phpleo a friend of mine blog about this topic with 2 code examples, a filter
made by him and a modified htaccess for symfony. They both will make this
work as expected.

Take a look at the code and download link. The blog is in spanish tho.
http://blog.phpleo.com/2008/01/27/redireccion-301-en-symfony-filtros-...

As a side note, if you use my htaccess you will have to use RewriteBase to
avoid routing problems.

Cheers,

On Jan 27, 2008 1:23 AM, James <thenet...@gmail.com> wrote:

--
Joan Piedra  ||  Frontend web developer
http://www.justaquit.com/  ||  http://www.joanpiedra.com/

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google