简体   繁体   中英

How to change index.php file path loading in .htaccess

I need to change my index.php file loading path so I placed as follows,

httpdocs
    new_path
         index.php

and I updated my .htaccess as follow,

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ new_path/index.php [NC,L]

but when I visit the http://www.mysite.com it says browser cannot find the page. Could anyone help me on this?

Thanks

Try this in your root .htaccess:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .* new_path/index.php [L]

I placed below bolded code above all I mentioned in my above question.

  

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ new_path/index.php [NC,L]

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