About. htaccess settings-php Tutorial

Source: Internet
Author: User
The Directory of the. htaccess project is
Project
Public
Index. php
Xxxx
Xxxx
The function you want to implement is no matter what url is used for access, such
Http: // localhost/project/
Http: // localhost/project/aaa. php
Http: // localhost/project/public/bbb. php
Can be switched to index. php under public
I now have a. htaccess under the project and public

Project/. htaccess


RewriteEngine On
RewriteCond % {REQUEST_URI }! Public/
RewriteRule (. *) public/$1 [L]




Public/. htaccess


RewriteEngine On
RewriteCond % {REQUEST_FILENAME }! -F
RewriteCond % {REQUEST_FILENAME }! -D
RewriteRule ^ index. php [QSA, L]


To access
Http: // localhost/project/public/bbb. php
You can go to index. php,
However
Http: // localhost/project/aaa. php
Cannot implement,

How can I set it?
Thank you.


Reply to discussion (solution)

No problem
Http: // localhost/project/aaa. php
[PHP_SELF] =>/project/public/index. php
[REDIRECT_URL] =>/project/public/aaa. php
[REQUEST_URI] =>/project/aaa. php

Http: // localhost/project/public/bbb. php
[PHP_SELF] =>/project/public/index. php
[REDIRECT_URL] =>/project/public/bbb. php
[REQUEST_URI] =>/project/public/bbb. php

The moderator means that there is no problem with this setting, right?
Why is my environment unavailable?

I used a Slim framework. Is it a slim problem?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.