Change Base link of website using .htaccess file

不想你离开。 提交于 2019-12-25 02:38:15

问题


can editing .htaccess file. Base address of site for all link on home page will changed?

scenario:My osclass hosted at openshift cloud with url http://myappdomain.rhcloud.com After adding alias at server side i am using www.mydomain.com with forwarding masking feature.Everyting is fine for home page.But poblem is when user click on any link on website.Browser URL field change from www.mydomain.com to http://myappdomain.rhcloud.com/link instead of www.mydoamin.com/link.but if user manually type www.mydomain.com/link it works and it remain same not changing to http://myappdomain.rhcloud.com/link in browser URL. Hover over links also show http://myappdomain.rhcloud.com/link not www.mydomain.com/link i even try to edit config.php file

define('WEB_PATH', 'http://www.mydomain.com/');

but it is not working. my point is can this acheive with editing .htaccess file with minimal effect or there some other way. Have anyone try openshift for osclass before with custom domain? wordpress and osclass are quite similar in architecture.Have wordpress users on openshift face such problem?


回答1:


Please note that .htaccess only changes the way server handles visitor's request. It does not change the contents in your web site. Therefore, you can never change your "hover result" with .htaccess settings.

I think that depends on how the links are generated in your website:

  1. If the links are stored along with HTML in database, you'd need to change it with database query. If you're using MySQL, please learn your database structure and form a correct REPLACE query.

  2. If the links are generated on-load, please make sure you flush all the caches. Cache may not know that your WEB_PATH has changed.



来源:https://stackoverflow.com/questions/21823640/change-base-link-of-website-using-htaccess-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!