Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If I understand your question correctly, you want to have requests for <code>/community/*</code> routed to <code>ResourcesController</code>. You should be able to acheive this by adding the following to your <code>app/config/routes.php</code>.</p> <pre><code>/** * Rename /resources/* to /community/* */ Router::connect('/community', array('controller' =&gt; 'resources')); Router::connect('/community/:action/*', array('controller' =&gt; 'resources')); </code></pre> <p>The second rule does most of the magic, mapping matching requests to the <code>ResourcesController</code> and passing in the action also.</p> <p>With the above approach you can also take advantage of reverse-routing:</p> <pre><code>echo $this-&gt;Html-&gt;link('View community', array( 'controller' =&gt; 'resources', 'action' =&gt; 'view', $id )); // outputs a link to `/community/view/171` </code></pre> <p>The first rule is simply there to keep the action name out of the root URL (ie. so <code>HtmlHelper</code> links that are reverse-routed become <code>/community</code> instead of <code>/community/index</code>).</p> <hr> <p>Following up on LazyOne's comment, if you are also looking to redirect old <code>/resources*</code>-style links for SEO purposes, the following should do the trick:</p> <pre><code># app/webroot/.htaccess &lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteRule ^/resources(.*)$ /community$1 [R=301,L] # permanent redirect RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] &lt;/IfModule&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload