You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Nilesh Govindarajan <li...@itech7.com> on 2010/05/17 17:09:58 UTC

[users@httpd] Redirecting / to non slash

Hi,

For SEO reasons, I'd like to redirect /page/ to /page, how to ?

-- 
Nilesh Govindarajan (निलेश गोविंदराजन)
Twitter: nileshgr
Facebook: nilesh.gr
Website: www.itech7.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Redirecting / to non slash

Posted by Kevin Castellow <ke...@gmail.com>.
Ahh.  I didn't read it correctly.
What result is desired when "/foo" is going to be served?
Do you want a directory listing, a default page, or is "/foo" a default page
without an extension?
Maybe that would help me understand the end goal because a directory still
has to have a default page of some sort.


But as stated previously by Tom Evans, the answer may not help your search
engine goal.

Regards,
Kevin Castellow


On Mon, May 17, 2010 at 12:47 PM, Tom Evans <te...@googlemail.com>wrote:

> On Mon, May 17, 2010 at 5:31 PM, Kevin Castellow
> <ke...@gmail.com> wrote:
> > I would take a look at this module:
> > http://httpd.apache.org/docs/2.2/mod/mod_dir.html
> >
> > Depending on how you built your Apache it should be there by default if
> you
> > used the "all" option for modules.
> >
> > It should do exactly what you are looking for.
> >
> > Regards,
> > Kevin Castellow
> > http://kevincastellow.workintel.com
> >
> >
>
> Thats the opposite of what he requested - he wants '/foo/' to be
> redirected to '/foo' and serve as if it was '/foo/'. mod_dir would
> redirect '/foo' to '/foo/' and serve '/foo/'.
>
> >
> >
> > On Mon, May 17, 2010 at 11:09 AM, Nilesh Govindarajan <li...@itech7.com>
> > wrote:
> >>
> >> Hi,
> >>
> >> For SEO reasons, I'd like to redirect /page/ to /page, how to ?
> >>
>
> Is '/page/' a directory? If so, I don't think you will be able to do
> this with apache. It may be possible with redirects, but it just seems
> a little OTT to do this because some snake oil merchant has told you
> this will boost your page rank on google.
>
> Cheers
>
> Tom
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] Redirecting / to non slash

Posted by Tom Evans <te...@googlemail.com>.
On Mon, May 17, 2010 at 5:31 PM, Kevin Castellow
<ke...@gmail.com> wrote:
> I would take a look at this module:
> http://httpd.apache.org/docs/2.2/mod/mod_dir.html
>
> Depending on how you built your Apache it should be there by default if you
> used the "all" option for modules.
>
> It should do exactly what you are looking for.
>
> Regards,
> Kevin Castellow
> http://kevincastellow.workintel.com
>
>

Thats the opposite of what he requested - he wants '/foo/' to be
redirected to '/foo' and serve as if it was '/foo/'. mod_dir would
redirect '/foo' to '/foo/' and serve '/foo/'.

>
>
> On Mon, May 17, 2010 at 11:09 AM, Nilesh Govindarajan <li...@itech7.com>
> wrote:
>>
>> Hi,
>>
>> For SEO reasons, I'd like to redirect /page/ to /page, how to ?
>>

Is '/page/' a directory? If so, I don't think you will be able to do
this with apache. It may be possible with redirects, but it just seems
a little OTT to do this because some snake oil merchant has told you
this will boost your page rank on google.

Cheers

Tom

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Redirecting / to non slash

Posted by Kevin Castellow <ke...@gmail.com>.
I would take a look at this module:
http://httpd.apache.org/docs/2.2/mod/mod_dir.html

Depending on how you built your Apache it should be there by default if you
used the "all" option for modules.

It should do exactly what you are looking for.

Regards,
Kevin Castellow
http://kevincastellow.workintel.com




On Mon, May 17, 2010 at 11:09 AM, Nilesh Govindarajan <li...@itech7.com>wrote:

> Hi,
>
> For SEO reasons, I'd like to redirect /page/ to /page, how to ?
>
> --
> Nilesh Govindarajan (निलेश गोविंदराजन)
> Twitter: nileshgr
> Facebook: nilesh.gr
> Website: www.itech7.com
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>  "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] Re: Redirecting / to non slash

Posted by Nilesh Govindarajan <li...@itech7.com>.
On 05/18/2010 12:25 PM, Igor Cicimov wrote:
> Dude, you really want everything serve on a plate :)
>
> RewriteRule (.*)/(.*)/$ $1/$2 [R=301,L]
>
> or even better
>
> RewriteRule (.*)/$ $1 [R=301,L]
>
>
>
> On Tue, May 18, 2010 at 4:37 PM, Nilesh Govindarajan <lists@itech7.com
> <ma...@itech7.com>> wrote:
>
>     On 05/18/2010 11:17 AM, Igor Cicimov wrote:
>
>         Don't forget to switch the rewrite engine on first though:
>
>         RewriteEngine On
>         RewriteRule (.*)/foo/$ $1/foo [R=301,L]
>
>         On Tue, May 18, 2010 at 3:45 PM, Igor Cicimov
>         <icicimov@gmail.com <ma...@gmail.com>
>         <mailto:icicimov@gmail.com <ma...@gmail.com>>> wrote:
>
>             Anything wrong with just simple redirect like this?
>
>             RewriteRule (.*)/foo/$ $1/foo [R=301,L]
>
>             Igor
>
>
>             On Tue, May 18, 2010 at 11:25 AM, Nilesh Govindarajan
>         <lists@itech7.com <ma...@itech7.com>
>         <mailto:lists@itech7.com <ma...@itech7.com>>> wrote:
>
>                 I am using Zend PHP Framework for my application, so all
>                 requests to non-existent files, directories (or links)
>         are sent
>                 to /index.php/foo/a/b/c/d...
>
>                 Now what happens is- /index.php/foo and /index.php/foo/
>         are the
>                 same page.
>
>                 Same page with two different urls is considered bad, so
>         how to
>                 redirect /foo/ to /foo.
>
>                 --
>                 Nilesh Govindarajan (निलेश गोविंदराजन)
>                 Twitter: nileshgr
>                 Facebook: nilesh.gr <http://nilesh.gr> <http://nilesh.gr>
>                 Website: www.itech7.com <http://www.itech7.com>
>         <http://www.itech7.com>
>
>
>
>           ---------------------------------------------------------------------
>                 The official User-To-User support forum of the Apache HTTP
>                 Server Project.
>                 See <URL:http://httpd.apache.org/userslist.html> for
>         more info.
>                 To unsubscribe, e-mail:
>         users-unsubscribe@httpd.apache.org
>         <ma...@httpd.apache.org>
>         <mailto:users-unsubscribe@httpd.apache.org
>         <ma...@httpd.apache.org>>
>
>         "   from the digest: users-digest-unsubscribe@httpd.apache.org
>         <ma...@httpd.apache.org>
>         <mailto:users-digest-unsubscribe@httpd.apache.org
>         <ma...@httpd.apache.org>>
>
>                 For additional commands, e-mail:
>         users-help@httpd.apache.org <ma...@httpd.apache.org>
>         <mailto:users-help@httpd.apache.org
>         <ma...@httpd.apache.org>>
>
>
>
>
>     A general rule is possible ?
>
>
>     --
>     Nilesh Govindarajan (निलेश गोविंदराजन)
>     Twitter: nileshgr
>     Facebook: nilesh.gr <http://nilesh.gr>
>     Website: www.itech7.com <http://www.itech7.com>
>
>     ---------------------------------------------------------------------
>     The official User-To-User support forum of the Apache HTTP Server
>     Project.
>     See <URL:http://httpd.apache.org/userslist.html> for more info.
>     To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>     <ma...@httpd.apache.org>
>     "   from the digest: users-digest-unsubscribe@httpd.apache.org
>     <ma...@httpd.apache.org>
>     For additional commands, e-mail: users-help@httpd.apache.org
>     <ma...@httpd.apache.org>
>
>

:D yeah, I tried both, but they insert the full system path into it 
which results in 404.

-- 
Nilesh Govindarajan (निलेश गोविंदराजन)
Twitter: nileshgr
Facebook: nilesh.gr
Website: www.itech7.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Redirecting / to non slash

Posted by Igor Cicimov <ic...@gmail.com>.
Dude, you really want everything serve on a plate :)

RewriteRule (.*)/(.*)/$ $1/$2 [R=301,L]

or even better

RewriteRule (.*)/$ $1 [R=301,L]



On Tue, May 18, 2010 at 4:37 PM, Nilesh Govindarajan <li...@itech7.com>wrote:

> On 05/18/2010 11:17 AM, Igor Cicimov wrote:
>
>> Don't forget to switch the rewrite engine on first though:
>>
>> RewriteEngine On
>> RewriteRule (.*)/foo/$ $1/foo [R=301,L]
>>
>> On Tue, May 18, 2010 at 3:45 PM, Igor Cicimov <icicimov@gmail.com
>> <ma...@gmail.com>> wrote:
>>
>>    Anything wrong with just simple redirect like this?
>>
>>    RewriteRule (.*)/foo/$ $1/foo [R=301,L]
>>
>>    Igor
>>
>>
>>    On Tue, May 18, 2010 at 11:25 AM, Nilesh Govindarajan
>>    <lists@itech7.com <ma...@itech7.com>> wrote:
>>
>>        I am using Zend PHP Framework for my application, so all
>>        requests to non-existent files, directories (or links) are sent
>>        to /index.php/foo/a/b/c/d...
>>
>>        Now what happens is- /index.php/foo and /index.php/foo/ are the
>>        same page.
>>
>>        Same page with two different urls is considered bad, so how to
>>        redirect /foo/ to /foo.
>>
>>        --
>>        Nilesh Govindarajan (निलेश गोविंदराजन)
>>        Twitter: nileshgr
>>        Facebook: nilesh.gr <http://nilesh.gr>
>>        Website: www.itech7.com <http://www.itech7.com>
>>
>>
>>
>>  ---------------------------------------------------------------------
>>        The official User-To-User support forum of the Apache HTTP
>>        Server Project.
>>        See <URL:http://httpd.apache.org/userslist.html> for more info.
>>        To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>        <ma...@httpd.apache.org>
>>
>>        "   from the digest: users-digest-unsubscribe@httpd.apache.org
>>        <ma...@httpd.apache.org>
>>
>>        For additional commands, e-mail: users-help@httpd.apache.org
>>        <ma...@httpd.apache.org>
>>
>>
>>
>>
> A general rule is possible ?
>
>
> --
> Nilesh Govindarajan (निलेश गोविंदराजन)
> Twitter: nileshgr
> Facebook: nilesh.gr
> Website: www.itech7.com
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>  "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] Re: Redirecting / to non slash

Posted by Nilesh Govindarajan <li...@itech7.com>.
On 05/18/2010 11:17 AM, Igor Cicimov wrote:
> Don't forget to switch the rewrite engine on first though:
>
> RewriteEngine On
> RewriteRule (.*)/foo/$ $1/foo [R=301,L]
>
> On Tue, May 18, 2010 at 3:45 PM, Igor Cicimov <icicimov@gmail.com
> <ma...@gmail.com>> wrote:
>
>     Anything wrong with just simple redirect like this?
>
>     RewriteRule (.*)/foo/$ $1/foo [R=301,L]
>
>     Igor
>
>
>     On Tue, May 18, 2010 at 11:25 AM, Nilesh Govindarajan
>     <lists@itech7.com <ma...@itech7.com>> wrote:
>
>         I am using Zend PHP Framework for my application, so all
>         requests to non-existent files, directories (or links) are sent
>         to /index.php/foo/a/b/c/d...
>
>         Now what happens is- /index.php/foo and /index.php/foo/ are the
>         same page.
>
>         Same page with two different urls is considered bad, so how to
>         redirect /foo/ to /foo.
>
>         --
>         Nilesh Govindarajan (निलेश गोविंदराजन)
>         Twitter: nileshgr
>         Facebook: nilesh.gr <http://nilesh.gr>
>         Website: www.itech7.com <http://www.itech7.com>
>
>         ---------------------------------------------------------------------
>         The official User-To-User support forum of the Apache HTTP
>         Server Project.
>         See <URL:http://httpd.apache.org/userslist.html> for more info.
>         To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>         <ma...@httpd.apache.org>
>         "   from the digest: users-digest-unsubscribe@httpd.apache.org
>         <ma...@httpd.apache.org>
>         For additional commands, e-mail: users-help@httpd.apache.org
>         <ma...@httpd.apache.org>
>
>
>

A general rule is possible ?

-- 
Nilesh Govindarajan (निलेश गोविंदराजन)
Twitter: nileshgr
Facebook: nilesh.gr
Website: www.itech7.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Redirecting / to non slash

Posted by Igor Cicimov <ic...@gmail.com>.
Don't forget to switch the rewrite engine on first though:

RewriteEngine On
RewriteRule (.*)/foo/$ $1/foo [R=301,L]

On Tue, May 18, 2010 at 3:45 PM, Igor Cicimov <ic...@gmail.com> wrote:

> Anything wrong with just simple redirect like this?
>
> RewriteRule (.*)/foo/$ $1/foo [R=301,L]
>
> Igor
>
>
> On Tue, May 18, 2010 at 11:25 AM, Nilesh Govindarajan <li...@itech7.com>wrote:
>
>> I am using Zend PHP Framework for my application, so all requests to
>> non-existent files, directories (or links) are sent to
>> /index.php/foo/a/b/c/d...
>>
>> Now what happens is- /index.php/foo and /index.php/foo/ are the same page.
>>
>> Same page with two different urls is considered bad, so how to redirect
>> /foo/ to /foo.
>>
>> --
>> Nilesh Govindarajan (निलेश गोविंदराजन)
>> Twitter: nileshgr
>> Facebook: nilesh.gr
>> Website: www.itech7.com
>>
>> ---------------------------------------------------------------------
>> The official User-To-User support forum of the Apache HTTP Server Project.
>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>  "   from the digest: users-digest-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>>
>

Re: [users@httpd] Re: Redirecting / to non slash

Posted by Igor Cicimov <ic...@gmail.com>.
Anything wrong with just simple redirect like this?

RewriteRule (.*)/foo/$ $1/foo [R=301,L]

Igor

On Tue, May 18, 2010 at 11:25 AM, Nilesh Govindarajan <li...@itech7.com>wrote:

> I am using Zend PHP Framework for my application, so all requests to
> non-existent files, directories (or links) are sent to
> /index.php/foo/a/b/c/d...
>
> Now what happens is- /index.php/foo and /index.php/foo/ are the same page.
>
> Same page with two different urls is considered bad, so how to redirect
> /foo/ to /foo.
>
> --
> Nilesh Govindarajan (निलेश गोविंदराजन)
> Twitter: nileshgr
> Facebook: nilesh.gr
> Website: www.itech7.com
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>  "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

[users@httpd] Re: Redirecting / to non slash

Posted by Nilesh Govindarajan <li...@itech7.com>.
I am using Zend PHP Framework for my application, so all requests to 
non-existent files, directories (or links) are sent to 
/index.php/foo/a/b/c/d...

Now what happens is- /index.php/foo and /index.php/foo/ are the same page.

Same page with two different urls is considered bad, so how to redirect 
/foo/ to /foo.

-- 
Nilesh Govindarajan (निलेश गोविंदराजन)
Twitter: nileshgr
Facebook: nilesh.gr
Website: www.itech7.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org