系统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>
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>
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>
单独一个网站就需要单独开启一个模块吗,不能全局配置吗,我按照这样的修改以后在重新启动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>
首页是500,我刚才是直接访问的模块 显示400,
然后在后面加 xx.com/index.php 访问也不行了
只要全局有一个就行了
我找到原因了,是默认创建.htaccess的时候权限问题,因为我是root登录的,所以创建这个文件的权限是ROOT,我有把它设置成
777的权限,但还是一样,刚才我试着修改成此网站的用户组和用户,然后刷新就可以了。
谢谢徐版,

The article discusses PHP, detailing its full form, main uses in web development, comparison with Python and Java, and its ease of learning for beginners.

PHP handles form data using $\_POST and $\_GET superglobals, with security ensured through validation, sanitization, and secure database interactions.

The article compares PHP and ASP.NET, focusing on their suitability for large-scale web applications, performance differences, and security features. Both are viable for large projects, but PHP is open-source and platform-independent, while ASP.NET,

PHP's case sensitivity varies: functions are insensitive, while variables and classes are sensitive. Best practices include consistent naming and using case-insensitive functions for comparisons.

The article discusses various methods for page redirection in PHP, focusing on the header() function and addressing common issues like "headers already sent" errors.

Article discusses type hinting in PHP, a feature for specifying expected data types in functions. Main issue is improving code quality and readability through type enforcement.

The article discusses PHP Data Objects (PDO), an extension for database access in PHP. It highlights PDO's role in enhancing security through prepared statements and its benefits over MySQLi, including database abstraction and better error handling.

Article discusses creating and securing PHP APIs, detailing steps from endpoint definition to performance optimization using frameworks like Laravel and best security practices.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Zend Studio 13.0.1
Powerful PHP integrated development environment

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 English version
Recommended: Win version, supports code prompts!
