假設如下:刪除模式和301重定向到新的URL
mywebsite.com/searches/index/page:x where x is an integer.
我想刪除索引/並重定向到
mywebsite.com/searches/page:x
我的web應用程序是基於CakePHP的,和我將以下行添加到了webroot目錄中的.htaccess文件,但它沒有得到任何結果。
RewriteRule ^(.*)/searches/index/(.*)$ searches/$1 [R=301,L]
我需要知道正確的.htaccess代碼,我應該使用。
但是,我問這個問題,因爲谷歌網站管理員工具告訴我,有很多軟401錯誤。在我的應用程序的路線我省略了調用由以下行的索引頁在routes.php文件:
Router::connect('/searches/index/*', array('controller' => 'error','action'=>'e404'));
Router::connect('/searches', array('controller' => 'searches', 'action' => 'index','page' => 1));
Router::connect('/searches/*', array('controller' => 'searches', 'action' => 'index'));
所以,如果有另一種解決方案,以克服CakePHP的谷歌問題,我可以理解的知道這一點。
我的蛋糕版本是1.2.11。
這是否被拒絕投票?很高興知道答案出了什麼問題,以便我可以糾正可能出現的錯誤,含糊之處等。 – ndm
+1投票它回答所需的問題! – Termis