开发者

.htaccess solution for localhost

开发者 https://www.devze.com 2023-02-14 05:00 出处:网络
I am developing local websites and keep having problems with wordpress sites when they use relative links such as:

I am developing local websites and keep having problems with wordpress sites when they use relative links such as:

<a href="/wp-content/themes/mytheme/myfile.php">

This resolves to my localhost document root (htdocs) instead of the root of the job (htdocs/myjob).

Is it possible to use an .htaccess file in the root of the job (htdocs/myjob) folder to "fix" this behaviour? Or is it possible to put this htaccess file in htdocs, check the HTTP_REFERER, and send the browser to the corre开发者_开发技巧ct site root?

Can you show me an example of the rewrite rule needed?

Any other suggestions would be welcome too.


In fact you mean absolute links. Relative links are what you want.

You should be able to configure the root directory in your Wordpress setup: this would be the correct approach.

0

精彩评论

暂无评论...
验证码 换一张
取 消