简体   繁体   中英

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 .

And I have include function in example.php. lets say, include('a.php');

Its looking for http://www.mysite.com/example/example2/a.php . I need it to look for http://www.mysite.com/a.php

Thank you!

Add below code in .htaccess file

<IfModule mod_rewrite.c>

    RewriteEngine on

    Options +FollowSymLinks

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

</IfModule>

You can add this line in your 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');

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