使用 url 重写时如何消除 php 中的内部服务器错误

问题描述 投票:0回答:3

我想重写 我的网址:

http://www.example.com/mypage.php?unm=hr

重写后:

http://www.example.com/hr

.htaccess 文件:

RewriteEngine On
RewriteRule ^([^/]*)$ /myuser.php?url=$1 [L]

但它引发了一个错误:

Internal Server Error

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

Please contact the server administrator at postmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

Apache/2.4.7 (Win32) OpenSSL/1.0.1e PHP/5.5.9 Server at localhost Port 80
apache .htaccess mod-rewrite
3个回答
1
投票

您必须指定所有 javascript 以及所有 css 文件都有完整路径 喜欢 我们通常访问文件就像

<link href="css/pygments-manni.css" rel="stylesheet"> 

现在你可以像这样使用了。

<link href="<?php echo $path ?>css/pygments-manni.css" rel="stylesheet"> 
$path="http://".$_SERVER['HTTP_HOST']."/" ;

0
投票

请确保以下事项:

  • mod_rewrite 在 apache 配置中启用
  • 您可以通过将以下行添加到 .htaccess 中任何规则或条件之前来启用重写模块:

RewriteEngine On


0
投票

C:\Users\BCA35\AppData\Local\Programs\Python\Python312

© www.soinside.com 2019 - 2024. All rights reserved.