search
HomeBackend DevelopmentPHP Tutorial 关于PHP伪静态的有关问题

关于PHP伪静态的问题!
我的.htaccess 这么写:


RewriteEngine on 
RewriteRule ([a-zA-Z]{1,})-([0-9]{1,}).html$index.php?action=$1&id=$2


程序代码:


echo '你的Action是:' . $_GET['action'];

echo "
";

echo '你的ID是:' . $_GET['id'];

?>

现在在浏览器中输入:
localhost/page-18.html

但是报错:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.


请问怎么解决?



------解决方案--------------------
RewriteRule ([a-zA-Z]{1,})-([0-9]{1,}).html$index.php?action=$1&id=$2
index.php前应该有空格
------解决方案--------------------
这有啥为什么啊,
rewriteRule要有原来的url和转去的url,你没空格,apache分不清啊,只好发疯500了
------解决方案--------------------
.htaccess就是apache的功能,不修改.conf不能生效, 不过现在大部分地方都是缺省就启用它

如果你是问能否在php里实现url分析及路由,Print_r你的$_SERVER, 里面有几个变量包含
完整的url,你可以自己写代码分析然后执行不同的代码

一些开源软件里都有相应的实现,可以参考

探讨

如果不修改Apache ,还可以实现这个功能吗?

------解决方案--------------------
探讨

如果不修改Apache ,还可以实现这个功能吗?

我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html
Statement
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
图文详解apache2.4+php8.0的安装配置方法图文详解apache2.4+php8.0的安装配置方法Dec 06, 2022 pm 04:53 PM

本文给大家介绍如何安装apache2.4,以及如何配置php8.0,文中附有图文详细步骤,下面就带大家一起看看怎么安装配置apache2.4+php8.0吧~

Linux apache怎么限制并发连接和下载速度Linux apache怎么限制并发连接和下载速度May 12, 2023 am 10:49 AM

mod_limitipconn,这个是apache的一个非官方模块,根据同一个来源ip进行并发连接控制,bw_mod,它可以根据来源ip进行带宽限制,它们都是apache的第三方模块。1.下载:wgetwget2.安装#tar-zxvfmod_limitipconn-0.22.tar.gz#cdmod_limitipconn-0.22#vimakefile修改:apxs=“/usr/local/apache2/bin/apxs”#这里是自己apache的apxs路径,加载模块或者#/usr/lo

apache版本怎么查看?apache版本怎么查看?Jun 14, 2019 pm 02:40 PM

查看​apache版本的步骤:1、进入cmd命令窗口;2、使用cd命令切换到Apache的bin目录下,语法“cd bin目录路径”;3、执行“httpd -v”命令来查询版本信息,在输出结果中即可查看apache版本号。

超细!Ubuntu20.04安装Apache+PHP8环境超细!Ubuntu20.04安装Apache+PHP8环境Mar 21, 2023 pm 03:26 PM

本篇文章给大家带来了关于PHP的相关知识,其中主要跟大家分享在Ubuntu20.04 LTS环境下安装Apache的全过程,并且针对其中可能出现的一些坑也会提供解决方案,感兴趣的朋友下面一起来看一下吧,希望对大家有帮助。

如何安装、卸载、重置Windows服务器备份如何安装、卸载、重置Windows服务器备份Mar 06, 2024 am 10:37 AM

WindowsServerBackup是WindowsServer操作系统自带的一个功能,旨在帮助用户保护重要数据和系统配置,并为中小型和企业级企业提供完整的备份和恢复解决方案。只有运行Server2022及更高版本的用户才能使用这一功能。在本文中,我们将介绍如何安装、卸载或重置WindowsServerBackup。如何重置Windows服务器备份如果您的服务器备份遇到问题,备份所需时间过长,或无法访问已存储的文件,那么您可以考虑重新设置WindowsServer备份设置。要重置Windows

php站用iis乱码而apache没事怎么解决php站用iis乱码而apache没事怎么解决Mar 23, 2023 pm 02:48 PM

​在使用 PHP 进行网站开发时,你可能会遇到字符编码问题。特别是在使用不同的 Web 服务器时,会发现 IIS 和 Apache 处理字符编码的方法不同。当你使用 IIS 时,可能会发现在使用 UTF-8 编码时出现了乱码现象;而在使用 Apache 时,一切正常,没有出现任何问题。这种情况应该怎么解决呢?

DJI Osmo Action 5 Pro: Release date mooted as retailer reveals launch pricing that could undercut GoPro Hero 13 BlackDJI Osmo Action 5 Pro: Release date mooted as retailer reveals launch pricing that could undercut GoPro Hero 13 BlackSep 04, 2024 am 06:51 AM

DJI has not confirmed any plans to introduce a new action camera yet. Instead, it seems that GoPro will get ahead of its rival this year, having teased that it will introduce two new action cameras on September 4. For context, these are expected to a

Windows Server 2025预览版迎来更新,微软改善Insiders测试体验Windows Server 2025预览版迎来更新,微软改善Insiders测试体验Feb 19, 2024 pm 02:36 PM

在发布WindowsServer的build26040版本之际,微软公布了该产品的官方名称:WindowsServer2025。一同推出的,还有Windows11WindowsInsiderCanaryChannel版本的build26040。有些朋友可能还记得,多年前有人成功将WindowsNT从工作站模式转换为服务器模式,显示微软操作系统各版本之间的共性。尽管现在微软的服务器操作系统版本和Windows11之间有明显区别,但关注细节的人可能会好奇:为什么WindowsServer更新了品牌,

See all articles

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 agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),