A small project was recently developed with CakePHP. Found a problem, the web search materials temporarily did not find a solution, want to ask you Daniel.
CakePHP is placed in the/animal/folder in the root directory of the Web site, all URLs are
http://sample.com/animal/:controller/...
You want to take the contents of one of the controllers to the top level directory, such as changing the controller named Dog to
http://sample.com/animal/dog/...
http://sample.com/dog/...
The current practice is to modify the. htaccess file under the root directory
Options +FollowSymLinksRewriteEngine onRewriteCond %{REQUEST_URI} !/$RewriteCond %{REQUEST_URI} !\.[^/\.]+$RewriteRule .* %{REQUEST_URI}/ [L,R]RewriteRule ^dog/(.*)/ animal/dog [L]RewriteRule ^dog/(.*) animal/dog [L]
But there is a problem, the link in HtmlHelper in view is still/animal/,
Paginator is also automatically added with/animal/
echo $this->Html->link( 'Dog', array('controller' => 'dog', 'action' => 'smile'));URL: http://sample.com/animal/dog/smile
How do I modify this type of problem in cakephp configuration? Without affecting the links of other controllers?
Thanks Thank you!!
Reply content:
A small project was recently developed with CakePHP. Found a problem, the web search materials temporarily did not find a solution, want to ask you Daniel.
CakePHP is placed in the/animal/folder in the root directory of the Web site, all URLs are
http://sample.com/animal/:controller/...
You want to take the contents of one of the controllers to the top level directory, such as changing the controller named Dog to
http://sample.com/animal/dog/...
http://sample.com/dog/...
The current practice is to modify the. htaccess file under the root directory
Options +FollowSymLinksRewriteEngine onRewriteCond %{REQUEST_URI} !/$RewriteCond %{REQUEST_URI} !\.[^/\.]+$RewriteRule .* %{REQUEST_URI}/ [L,R]RewriteRule ^dog/(.*)/ animal/dog [L]RewriteRule ^dog/(.*) animal/dog [L]
But there is a problem, the link in HtmlHelper in view is still/animal/,
Paginator is also automatically added with/animal/
echo $this->Html->link( 'Dog', array('controller' => 'dog', 'action' => 'smile'));URL: http://sample.com/animal/dog/smile
How do I modify this type of problem in cakephp configuration? Without affecting the links of other controllers?
Thanks Thank you!!