Table of Contents
回复讨论(解决方案)
Bad Request
Home Backend Development PHP Tutorial thinkphp隐藏index.php以后500

thinkphp隐藏index.php以后500

Jun 23, 2016 pm 01:54 PM
500 index.php thinkphp hide

系统linux+php5.3
tp3.1.2  

按照TP的手册说修改 httpd.conf 的  mod_rewrite.so 模块分号
然后还有 AllowOverride None 将None改为 All (这个地方在httpd.conf里面有5处,我都修改成了All,不知道是否是正确的,还是只是需要修改一处就可以了?)

URL_MODEL设置为2   这个在配置文件里面也设置成了2,然后在写一个 ..htaccess 放在网站的根目录,内容如下


RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]


然后重新启动httpd,结果提示 500 Internal Server Error ,开始我以为是我apache的问题,最后我看其他的网站又正常(这台linux有多个网站),最后把 .htaccess删除以后打开网站又恢复正常,如果在放.htaccess又出现问题,那就可以说明.htaccess有问题了,是不是这个里面的内容有问题呢,还是需要php.ini在设置其他的呢



回复讨论(解决方案)

<IfModule mod_rewrite.c>RewriteEngine on#如果目录存在就直接访问目录不进行RewriteRuleRewriteCond %{REQUEST_FILENAME} !-d#如果文件存在,就直接访问文件,不进行下面的RewriteRule.(不是文件或文件不存在就执行重写)RewriteCond %{REQUEST_FILENAME} !-f#所有找不着实际路径的文件,统一交给index.php处理RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]</IfModule>
Copy after login
Copy after login

TP 自己就带有 .htaccess

你看看这里 http://blog.csdn.net/qq1355541448/article/details/21375407

<IfModule mod_rewrite.c>RewriteEngine on#如果目录存在就直接访问目录不进行RewriteRuleRewriteCond %{REQUEST_FILENAME} !-d#如果文件存在,就直接访问文件,不进行下面的RewriteRule.(不是文件或文件不存在就执行重写)RewriteCond %{REQUEST_FILENAME} !-f#所有找不着实际路径的文件,统一交给index.php处理RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]</IfModule>
Copy after login
Copy after login

TP 自己就带有 .htaccess

你看看这里 http://blog.csdn.net/qq1355541448/article/details/21375407



我按照这个BLOG的地址设置了,也就是大概意思是 httpd.conf里面要单独设置,比如一个网站

<VirtualHost *:80>    LoadModule rewrite_module modules/mod_rewrite.so //我写在这里了,    ServerAdmin webmaster@dt.e.com    DocumentRoot /web/xx.com    ServerName xx.com    ErrorLog logs/errun-error_log    CustomLog logs/acrun-access_log common</VirtualHost>
Copy after login


单独一个网站就需要单独开启一个模块吗,不能全局配置吗,我按照这样的修改以后在重新启动httpd.启动是可以,但是报了一个错误


然后问题依旧~

只要全局有一个就行了



我这修改以后网站根目录没有放.htaccess文件,这样提示,根目录放了也是提示400 Bad Request


<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><html><head><title>400 Bad Request</title></head><body><h1 id="Bad-nbsp-Request">Bad Request</h1><p>Your browser sent a request that this server could not understand.<br /></p></body></html>
Copy after login


首页是500,我刚才是直接访问的模块 显示400,

然后在后面加  xx.com/index.php  访问也不行了

只要全局有一个就行了



我找到原因了,是默认创建.htaccess的时候权限问题,因为我是root登录的,所以创建这个文件的权限是ROOT,我有把它设置成
777的权限,但还是一样,刚才我试着修改成此网站的用户组和用户,然后刷新就可以了。


谢谢徐版,
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Win11 input method floating window hidden settings Win11 input method floating window hidden settings Dec 30, 2023 pm 11:24 PM

Some friends are not used to the floating window function of win11 input method, and it always feels strange to use, so they want to turn off this floating window function. Now I will introduce to you the correct operation method of closing the floating window in win11 system. Follow along. Win11 hides the input method floating window 1. Open the settings key of the computer, and then select "Time and Language". After entering, click "Enter" 2. Find "Switch Input Method" in "Advanced Keyboard Settings", and then change "Desktop Language" Click the check mark in front of "Bar", and then enter "Language Bar Options" 3. After opening, we click "Hide" here to close the language floating window.

How to hide Windows 11 taskbar icons? How to hide Windows 11 taskbar icons? Jan 06, 2024 am 08:38 AM

In the win11 system, if we find the icons in the taskbar troublesome, we can choose to hide them in the taskbar corner overflow interface. However, the icons in the taskbar of the application opened below cannot be hidden. Let’s follow the editor below. Let’s look at the specific situation. How to hide the win11 taskbar icon: 1. Center the icon 1. First, if we want to hide the icon in the taskbar below, we can right-click to select it and click "Unpin from taskbar" 2. But if we open this application and are in the process Use it and that's impossible to hide. 2. Icon in the lower right corner 1. If you want to hide the application icon in the lower right corner, first open the system settings. 2. Then click "Personalization" on the left sidebar, as shown in the picture. 3. Then click to enter the taskbar on the right

How to run thinkphp project How to run thinkphp project Apr 09, 2024 pm 05:33 PM

To run the ThinkPHP project, you need to: install Composer; use Composer to create the project; enter the project directory and execute php bin/console serve; visit http://localhost:8000 to view the welcome page.

How to hide WeChat friends without blocking or deleting them? How to hide WeChat friends without blocking or deleting them How to hide WeChat friends without blocking or deleting them? How to hide WeChat friends without blocking or deleting them Mar 13, 2024 pm 07:19 PM

How to hide WeChat friends without blocking or deleting them? Many users want to hide some friends but don’t know how to do it. Let this site carefully introduce to users how to hide WeChat friends without blocking or deleting them. Methods to hide WeChat friends without blocking or deleting Method 1: 1. First open the WeChat software, find the address book on the WeChat page, and click "My". 2. Then we enter the settings page. 3. Find the “Privacy” option and click on it. 4. Then click "Don't let him see". 5. Go to the Do Not Let Her View page and click "+" to check the friends you want to hide.

There are several versions of thinkphp There are several versions of thinkphp Apr 09, 2024 pm 06:09 PM

ThinkPHP has multiple versions designed for different PHP versions. Major versions include 3.2, 5.0, 5.1, and 6.0, while minor versions are used to fix bugs and provide new features. The latest stable version is ThinkPHP 6.0.16. When choosing a version, consider the PHP version, feature requirements, and community support. It is recommended to use the latest stable version for best performance and support.

How to hide works in Douyin short videos How to hide personal video works How to hide works in Douyin short videos How to hide personal video works Mar 12, 2024 pm 12:49 PM

There are many short video works provided in the Douyin short video app software. You can watch them as you like, and they are all permanently provided free of charge. Different types of live video channels are open, and all video content is original, with Give everyone the most satisfying way to watch. Enter your account to log in online, and a variety of exciting short videos will be pushed, which are accurately recommended based on what everyone watches every day. You can also enter the live broadcast room to interact and chat with the anchor, making you feel more happy. Works uploaded by individuals can also be hidden. It is very simple to set up with one click. You can see wherever you swipe. Swipe up and down to see the real-time comments of countless netizens. You can also share daily life dynamics. Now the editor has detailed online Douyin short videos. Users push for ways to hide personal video works. First open Douyin short video

How to run thinkphp How to run thinkphp Apr 09, 2024 pm 05:39 PM

Steps to run ThinkPHP Framework locally: Download and unzip ThinkPHP Framework to a local directory. Create a virtual host (optional) pointing to the ThinkPHP root directory. Configure database connection parameters. Start the web server. Initialize the ThinkPHP application. Access the ThinkPHP application URL and run it.

How to hide Smart Island on Xiaomi Mi 14? How to hide Smart Island on Xiaomi Mi 14? Mar 18, 2024 pm 03:40 PM

In addition to the amazing hardware configuration and excellent functions, Xiaomi Mi 14 also hides a fascinating place - Smart Island. Here, users can enjoy personalized customization and unlimited creative mobile phone experience. But not everyone likes this feature, so how does Xiaomi Mi 14 hide Smart Island? Let’s find out together. How to hide Smart Island on Xiaomi Mi 14? 1. Open the settings application of Xiaomi 14 mobile phone. 2. Scroll to find the &quot;Features&quot; option and click to enter. 3. Find the &quot;Hide Smart Island&quot; option on the features page and turn it on. 4. After confirming that hiding the Smart Island is turned on, return to the desktop and you will see that the Smart Island has been hidden.

See all articles