简体   繁体   English

url-rewriting - 设置默认的网站路径

[英]url-rewriting - set default web-site path

How can I set a default path for files? 如何设置文件的默认路径?

What i mean that if i have this address for exapmle: http://www.mysite.com/example/example2 for the file example.php . 我的意思是,如果我有这个地址的exapmle: http://www.mysite.com/example/example2 ://www.mysite.com/example/example2的文件example.php

And I have include function in example.php. 我在example.php中包含了函数。 lets say, include('a.php'); 比方说, include('a.php');

Its looking for http://www.mysite.com/example/example2/a.php . 它正在寻找http://www.mysite.com/example/example2/a.php I need it to look for http://www.mysite.com/a.php 我需要它来寻找http://www.mysite.com/a.php

Thank you! 谢谢!

Add below code in .htaccess file 在.htaccess文件中添加以下代码

<IfModule mod_rewrite.c>

    RewriteEngine on

    Options +FollowSymLinks

    RewriteRule ^(.*)$ example/example2/a.php

</IfModule>

You can add this line in your DOCUMENT_ROOT/.htaccess : 您可以在DOCUMENT_ROOT/.htaccess添加此行:

php_value include_path "/full/path/to/Document/Root:."

to set include path that will let you include file as include('a.php'); 设置包含路径,让你包含文件为include('a.php');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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