简体   繁体   中英

htaccess - Access root subfolder

I believe this question is purely PHP related, a language in which my knowledge is limited and I'm still learning things, keep that in mind.

I installed Ionize CMS on a client's server and everything is going smooth. But there is one little thing I wish I could do and it reaches the extent of my PHP knowledge.

I want to know if it is possible to access the content of a folder located at the root of my site from my web browser, which is not ionize related. I need to access the old backup of a website. In other words, I want to be able to write in the url the path and see the content in the web browser. Ex:

http://mysite/backup/index.php

For the moment, if I try that, the page displays the ionize 404 not found message.

I guess it has something to do with the htaccess file, but I'm really not sure how to modify this file to do what I want, if possible.

I did a bit of research and found this code, but if someone could explain it to me that would be great, as my php knowledge is not that great like mentioned earlier. I don't want to test it right now without knowing what it does, I don't want to permanently damage my website rewrite function..

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/subdirectoryname1/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/subdirectoryname2/(.*)$ [OR]
RewriteRule ^.*$ - [L]
</IfModule>

Anyone could spare some knowledge on the feasibility of my question?

Much appreciated

This rule basically says if the requested URI (folder) is subdirectoryname1 or subdirectoryname2 don't do anything and stop processing the rules. So a rule like this should work for you. The rules have to come before your ionize rules.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/subdirectoryname1/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/subdirectoryname2/(.*)$
RewriteRule ^.*$ - [L]
</IfModule>

You can also just do this for your situation which does the same thing.

RewriteEngine On
RewriteBase /
RewriteRule ^backup/?(.*?)/?$ - [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