Hello, php url. I have a problem: my houtai directory is under view, not the root directory. If you enter http: // ip/houtai, 404 is returned to view the Apache log. you can find the houtai folder in the root directory of the server, and then the error 404 is not found. what I expect is that the PHP framework parses the houtai folder and goes to the view folder to find the page. Is there a problem with the configuration? is the URL rewrite rule incorrect?
Online, etc. thank you.
Reply to discussion (solution)
Put the houtai directory under view, not the root directory
How did you allow your host to access the files under view?
This problem cannot occur if your deployment complies with the current PHP framework specifications.
In addition, if http: // ip/houtai does not write a rewritefile, search for the following index.php.html file and change it to http: // ip/index. php/houtai.
This problem cannot occur if your deployment complies with the current PHP framework specifications.
In addition, if http: // ip/houtai does not write a rewritefile, search for the following index.php.html file and change it to http: // ip/index. php/houtai.
I suspect there is a problem with pseudo-static enabling.
What rewrite rules does your framework use now? If not, it is normal to read houtai from the root directory.
Do you want to write a rewrite rule to access http: // ip/houtai rewrite to http: // ip/view/houtai?
Write the rewrite rules on the server. map the houtai to/view/houtai.
What rewrite rules does your framework use now? If not, it is normal to read houtai from the root directory.
Do you want to write a rewrite rule to access http: // ip/houtai rewrite to http: // ip/view/houtai?
I don't want to go directly to the root directory to find files. I want the server to ignore the files or folders with ip addresses first, and first go to the root directory index. php, parse the URI through the MVC framework of PHP, and search for the URI under view. Can I use. htaccess in this way? Hehe, PHP beginners seek guidance.
What rewrite rules does your framework use now? If not, it is normal to read houtai from the root directory.
Do you want to write a rewrite rule to access http: // ip/houtai rewrite to http: // ip/view/houtai?
I don't want to go directly to the root directory to find files. I want the server to ignore the files or folders with ip addresses first, and first go to the root directory index. php, parse the URI through the MVC framework of PHP, and search for the URI under view. Can I use. htaccess in this way? Hehe, PHP beginners seek guidance.
Added: my controller also contains the houtai folder.
If you have any questions, let's just say, why should we go around such a circle?
RewriteEngine on # if the directory exists, access the directory directly without RewriteRuleRewriteCond % {REQUEST_FILENAME }! -D # if the file exists, access the file directly without RewriteRule. (if the file does not exist or the file does not exist, rewrite it.) RewriteCond % {REQUEST_FILENAME }! -F # all files that cannot find the actual path should be handed over to index. php for RewriteRule ^ (. *) $ index. php/$1 [QSA, PT, L]
You need to write a pseudo-static rule to direct your desired url to index. php. the file or folder after the ip address/is passed as a parameter to index. php.
For example: RewriteRule ^ (. *) $/index. php? /$1
How to write rules depends on how your framework parses the url.
If you have any questions, let's just say, why should we go around such a circle?
RewriteEngine on # if the directory exists, access the directory directly without RewriteRuleRewriteCond % {REQUEST_FILENAME }! -D # if the file exists, access the file directly without RewriteRule. (if the file does not exist or the file does not exist, rewrite it.) RewriteCond % {REQUEST_FILENAME }! -F # all files that cannot find the actual path should be handed over to index. php for RewriteRule ^ (. *) $ index. php/$1 [QSA, PT, L]
I wrote it in. htaccess in the root directory. it does not take effect.
Http://www.jb51.net/article/25476.htm
What rewrite rules does your framework use now? If not, it is normal to read houtai from the root directory.
Do you want to write a rewrite rule to access http: // ip/houtai rewrite to http: // ip/view/houtai?
I don't want to go directly to the root directory to find files. I want the server to ignore the files or folders with ip addresses first, and first go to the root directory index. php, parse the URI through the MVC framework of PHP, and search for the URI under view. Can I use. htaccess in this way? Hehe, PHP beginners seek guidance.
That is, the rewrite of the website using a single portal is the same as thinkphp.
Create a. htaccess file under the root directory of the project, which writes the following content:
RewriteEngine onRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
Enable. htaccess
Open httpd. conf (where? In the CONF Directory of the APACHE Directory.
(1)
Options FollowSymLinks
AllowOverride None
Change
Options FollowSymLinks
AllowOverride All
(2) remove the following comments.
LoadModule rewrite_module modules/mod_rewrite.so
Http://www.jb51.net/article/25476.htm
When I Load the rewrite module in Apache conf, the module rewrite_module is built-in and can't be loaded. it should be built-in and no Load is needed. Then AllowOverride All is set in vhost conf, but. htaccess still does not take effect.
Http://www.jb51.net/article/25476.htm
When I Load the rewrite module in Apache conf, the module rewrite_module is built-in and can't be loaded. it should be built-in and no Load is needed. Then AllowOverride All is set in vhost conf, but. htaccess still does not take effect.
. Htaccess never takes effect. if you place the rewrite rule in the conf file under the vhost, the website reports a 400 error. Please help