As we define the home page in the admin, it would be marvelous to have that page redirected to the root automatically.
ex:
when home page is: node
then redirect http://example.com/node to http://example.com/ without checking the aliases...

At this time I made an alias for /node => / that results in a redirect to http://example.com// almost perfect if it wasn't for the double slashes at the end...

Thanx for this great module!

Comments

RayZ’s picture

Title: Redirection of the fome page » Redirection of the foam page

Spelled "foam" wrong.

RayZ’s picture

Title: Redirection of the foam page » Redirection of the home page

Just kidding :-)

nicholasthompson’s picture

Thanks for (eventually) correcting the typo RayZ :-)

I wonder if this is a similar issue to that of the trailing slash problem described in your other issue (http://drupal.org/node/89703)

I will investigate.

ednique’s picture

not really... and yes a little...

I'm just saying that if you take the default homepage admin setting,
you could redirect any request to that default page to the root (http://example.com)

If that is done I can remove my dirty fix...
where I add a url alias for /node pointing to / (the to cannot be blank...)
thanx to the redirection when I type http://example.com/node I'm redirected to http://example.com//
With the alias in place a lot of "Home" links have the url http:/// ... not so good...
that's why I want to get rid of the alias...

so I thought the redirect would be great...
people going to http://example.com/node would be redirected to http://example.com because node is entered in the admin as being the home page...

maybe restrict this action and only redirect the home node if NO alias exist for that node...
If their is an alias just redirect to the alias...
it could be that someone puts index.html as the alias of /node and in that case one would expect to see index.html

nicholasthompson’s picture

Interesting - so when its doing its alias check, it could also do a check to see if the current URL is the current site homepage...

Thought.... Whats if

  • You set your homepage to node/123
  • You create an alias for node/123 to homepage
  • You try to load your site

The module would see an alias is present and try to redirect to that alias - however that alias is NOT the homepage... Then again - does drupal allow aliases in the site homepage or is it system URL's only?

I can see that this module could EASILY solve this problem - however I want to make sure nothing gets broken in the process.

ednique’s picture

Yes drupal allows an alias for the homepage

I can emagine that the site would be redirecting forever in your example..
Thus as I stated before this module should only redirect to the home page if NO alias defined...

nicholasthompson’s picture

ok... Thinking about it - using my above example, would this work?

  1. If the current URL has an alias, redirect to that alias, otherwise continue
  2. If the frontpage is set, compare it to the current URL - if matches, redirect to '/' otherwise continue
  3. If the frontpage is set, check if it has an alias in the url_alias table. Compare THAT to the current URL - if matches, redirect to '/' otherwise continue
  4. Either finish without any changes or redirecting - or do anything else we later decide to add
ednique’s picture

Seems good to me...

nicholasthompson’s picture

Status: Active » Fixed

Mostly fixed in 1.3 - it only compared the current url to the site's frontpage - it doesn't check for any aliases of the frontpage. I cant think of any situation where you have aliases of a frontpage - you should never need to view it on its own anyway (hence this patch).

Anonymous’s picture

Status: Fixed » Closed (fixed)