简体   繁体   中英

Redirecting using .htaccess and Zend Error Controller?

I had an old website indexed by google with links such as the following:

http://www.example.co.za/about/about.html

however I have now switched to Zend Framework as the back end for my site with URL's of the form:

http://www.example.co.za/about/about/

I have edited the Zend Error Controller to:

$this->_redirect('/home');

however when the .html page is specified, it does not redirect?

Should i be changing something in .htaccess or can it still be redirected through the error controller?

Update:

i would actually prefer to have something that catches the requested url and then redirects to the correct place based on the content of that URL.

how can that be achieved?

If there are a smallish number of 'known' URLs you want to redirect, you can do this with htaccess alone, which will be much faster than doing it with PHP. Add this line to the top of your .htaccess file (above the Rewrite stuff):

Redirect 301 /about/about.html http://www.example.co.za/about/about/

and then repeat that for each URL you want redirected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM