This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Developer » How to shorten url via RewriteRule ?

How to shorten url via RewriteRule ?

How to shorten url via RewriteRule ?

Tuesday 07 August 2012 2:43:38 pm - 2 replies


I need to promote short urls of my website on social networks.
To create those short urls, I thought I could just use an Apache RewriteRule and node_id.

Example :

Short : (/s/ standing for "short"...)

Long :

Unfortunately, I can not have the redirect to work when I had this rule in Apache : 

Rewriterule ^/s/(.*) /content/view/full/$1
=> I get a blank page with error message "The requested URL /p/8783 was not found on this server."

Rewriterule*)$1 [L]
=> I get an ez page with error message "The requested module s could not be found."

What do you think ?

Could I make it with RewriteRules ?

Do you think I have to use an extension such as ?

Thanks in advance for your help happy.gif Emoticon


Wednesday 08 August 2012 8:42:41 am

Hi Mickael,

A few points:

  1. Your RewriteRules have a lowercase "r" on the Rule - this will cause Apache to fail
  2. Your 1st RewriteRule looks ok, but should probably have an [L] at the end
  3. Are you using .htaccess or VirtualHosts?  If .htaccess, you need to remove the beginning slash, ie ^s/ 
  4. You can forget RewriteRules completely and just use the built-in eZ Publish functionality in Admin > Setup > URL wildcards
    e.g New URL Wildcard = s/* and Destination = content/view/full/{1}

Hope that helps!  If it resolves your issue, please click the speech bubble up top to mark this issue as resolved.



Modified on Wednesday 08 August 2012 8:43:48 am by Geoff Bentley

Wednesday 08 August 2012 10:51:34 am

Hi Geoff,

Thanks a lot for your precise and useful answer.

Url wildcards indeed seem to fulfill my need, and are very simple to set !

Thanks again happy.gif Emoticon


Modified on Wednesday 08 August 2012 10:52:03 am by Mickael Robin


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from