Hi,

Is it possible to use wildcards in url aliases?

For instance, I would like an alias like /contact/webmaster/% that is the drupal path /contact/responsable du site/%, so I can type for instance /contact/webmaster/this one and it will redirect to /contact/responsable du site/this one.

Thanks

Comments

gpk’s picture

You can do this by defining http://api.drupal.org/api/function/custom_url_rewrite_inbound/6 in your settings.php.

gpk
----
www.alexoria.co.uk

Julien PHAM’s picture

The problem with this function is that it does not do an invisible redirection.
I would like my url to stay http://www.mindenice.fr/commercial/subject for instance.

I have tried in .htaccess to do a :
RewriteRule ^contact/commercial(.*)$ /contact/Service\ Commercial$1 [L]

But it does not work well and all my website is messy with that, I guess because of the space in the redirection link. Any idea on how I can fix this?

Thanks

gpk’s picture

I don't entirely follow what your problem is. http://api.drupal.org/api/function/custom_url_rewrite_inbound/6 maps a URL sent by the browser onto a different internal "Drupal" path (in much the same way that a URL alias does) but the URL in the browser stays the same. If you want the URLs of links on the resulting page as produced by Drupal to be in the form of the request then you may have to use http://api.drupal.org/api/function/custom_url_rewrite_outbound/6 with suitable conditional tests but as I say I'm not 100% clear what you are trying to achieve.

I always avoid spaces in URLs; as a minimum you may need to encode them e.g. to %20 or somesuch or use _ or - instead.

gpk
----
www.alexoria.co.uk

ralf.strobel’s picture

Just because this thread is still high in Google results...

There is now a module to do this: Extended path aliases