url_alias prefix questions

jmather - September 14, 2009 - 17:27
Project:Domain Access
Version:6.x-2.0-rc9
Component:- Domain Prefix
Category:feature request
Priority:normal
Assigned:Unassigned
Status:postponed
Description

Not to beat a dead horse here, but I want to make sure I have a clear understanding of what happens when I prefix url_alias.

Say I have attached a url alias to a node, and they get aliased like:

category/title

If I have multiple domains and I do NOT prefix the url_alias table, then each domain will be able to see the node at the alias if they have the correct affiliate domain access settings correct?

If I do prefix the url_alias table and I create the node with the alias on a particular domain, then only that domain will be able to see the alias, regardless of the affiliate domain access settings (they will be able to access the node path, but not the alias) correct?

From reading the other issues, it was not clear to me, if I did prefix the url_alias table that there was way (or a patch) that would allow the alias to get created for each domain selected in the affiliate settings...is there a way to do that?

The part that I'm struggling with is that I have a lot of static url alias's that live across domains that can be potentially the same, and I have a lot of taxonomy that I would like to display using an alias, and this alias would need to be filtered by domain access affiliate settings and yet provide a simple means for users to create an alias across domains without having to create the alias for the node across each domain manually.

Any input is much appreciated.

#1

jmather - September 15, 2009 - 14:55

Sorry, was I way off here? I'm just looking for a little clarity as to how to maintain a prefixed url_alias table and if it is possible to have the affiliate sites url_alias's updated when a node is saved (I think)....again, any helpful discussion or pointing out of my misunderstandings are welcomed ;)

#2

agentrickard - September 15, 2009 - 15:47

If you prefix the {url_alias} table, that table will be used for whatever the active domain is. That is:

-- You have one.example.com and two.example.com.
-- You prefix {url_alias} for two.example.com.
-- Any node loaded on one.example.com uses its table {url_alias}
-- Any node loaded on two.example.com uses its table {domain_2_url_ailas}
-- Nodes saved from one.example.com have their paths saved to {url_alias}
-- Nodes saved from two.example.com have their paths saved to {domain_2_url_alias}
-- If you are viewing a two.example.com node from one.example.com, however, the link will use the alias from {domain_2_url_alias}.

If you add a three.example.com and do not prefix the table, it will use {url_alias}.

This is how db prefixing works in Drupal, and with DA. The active site determines which table to use. No attempt is made to reconcile the table with the data that is entered.

#3

jmather - September 15, 2009 - 21:52

You said:

"-- If you are viewing a two.example.com node from one.example.com, however, the link will use the alias from {domain_2_url_alias}."

I seem to be seeing different behavior (this is not with subdomains as in your example above, don't think that makes a difference):

1) I prefix url_alias on domain2.com
2) I create a node on domain2.com that is published to domain1.com and domain2.com
it is now domain2.com/node/80 and its alias is domain2.com/name/title
3) I verify that the domain_2_url_alias contains the alias for node/80 to name/title
4) I verify that the url_alias table does not contain the same alias
5) I browse to domain2.com/name/title and I see the node
6) I browse to domain1.com/name/title and I get a "page can not be found" -- my custom 404 error
7) If I browse to domain1.com/node/80 I can view the node as would be expected.

I have tried changing the default source domain settings as well, but that did not seem to have any effect in this case. The behavior you described, is the behavior I'm looking to provide :)

It seems when I browse a node created from domain2.com on domain1.com it does not want to use the alias for the link from {domain_2_url_alias}...

Do I have some settings missing?

#4

agentrickard - September 15, 2009 - 23:55

This is the expected behavior. #6 happens because that path does not exist on one.example.com. What I tried to say was that _links_ that are shown on one.example.com will go to the proper domain and path.

If you want to change this behavior, you need a custom module.

#5

jmather - September 16, 2009 - 00:51

Gotcha...thanks for your help.

I'm not entirely convinced that I would want to create a custom module that would do something like this, but in the sense of entertaining the idea would you mind giving me a few pointers as to the direction I would need to take to do something like that?

On a side note...is there any other way to ensure that when a path alias is created on one domain and the content is shared across affiliates it will be viewable at that path alias to those affiliates or is that just the nature of the beast? I'm primarily running into this where I have panels that have the same menu item/path and I need them to be the same across domains....

again...your time is very much appreciated...

#6

agentrickard - September 16, 2009 - 14:19

For the custom module, implement hook_nodeapi() and watch the $node->path and $node->domains values, then act accordingly, being sure to prefix the tables properly.

The second question is a bigger issue, since the URL rewrite rules only apply to nodes. If a panel has different aliases on different domains, it will show the alias for whatever domain is loaded. You would need similar logic to what is in domain_prefix.path.inc to fire for all URLs. This means implementing custom_url_rewrite_outbound() (really, using the URL Alter module now) and checking _every_ path that comes across. This would be very resource intensive.

#7

jmather - September 16, 2009 - 22:37

Thanks again for all your help, will post again if I go down the custom module path, but following other examples like the row 11 wine case study, I think I will prefix my static urls for now (meaning domain1/myprefix/about, domain2/myprefix2/about etc) unless this becomes a problem for me, then I might look at the custom url. Thanks

#8

agentrickard - September 17, 2009 - 14:12
Category:support request» feature request
Status:active» postponed

A generalized Domain Path module to handle paths other than /node/%n would be a great contribution.

 
 

Drupal is a registered trademark of Dries Buytaert.