How To Safely Change Url Manager On A Live Running Website?

I have a site running yii framework with the default url structure of /index.php?r=<controller>/<view>&id=<id>

For SEO purposes, I need to change this structure to /<controller>/<view>/<id>. However, after the required changes, the old urls seems not to work. How can I make sure that the old urls redirect to new urls instead of simply opening up the home page.

I have changed my urlManager and everything works fine after a refreash fo the current page. When you say ‘old URLs’, Did you hard code the links in your code? you need to use the createUrl() functions and not hard coding.

After a couple of minutes of thought. I think that setting the showScript=>false (the one that hides index.php) you need to modify the .htaccess file to get it to work. At least there is one of the urlManager settings that needs a server access modification. Just search "yii urlManager SEO"

Hi jkofsky,

I have changed the url manager and edited .htaccess and it works fine in localhost. However, by old urls, I mead urls given on other websites and search engines. I want that if somebody goes to /index.php?r=api/docs referenced from search engines or other websites , it should be redirected to /api/docs instead of coming up with home page.

Not sure how to do it, but I would look into the .htaccess rewrite rules to see if ?r= could be translated. Search engines I would believe would catch up and change the old links…eventually 8)