在下一种情况下,我没有看到错误在哪里,我在php文件中有一段代码,我有这个:
<?
if(mysql_num_rows($c1=mysql_query("SELECT id_articulo, nombre, url, valido FROM landing_articulos WHERE 1 ORDER BY valido DESC, nombre ASC"))){
while($f1=mysql_fetch_array($c1)){
?>
<div style="float:left; width:32%; padding-left:0px; color:#ef5000; font-weight:bold; margin:5px;"><p><a href="/at-<?=$f1["url"]?>_<?=$f1["id_articulo"]?>.html" target="_blank"><strong><?=$f1["nombre"];?></strong></a> <a href="editar_nuevapagina.php?id=<?=$f1["id_articulo"]?>"><img src="imagenes/lapiz.png" width="15" height="15" border="0"/></a> </a> <a href="javascript:eliminar_art('<?=$f1["id_articulo"]?>');"><img src="imagenes/delete.png" width="15" height="15" border="0"/></a> <? if($f1["valido"]=='0')echo ' - SIN VALIDAR';?></p></div>
<?
}
}
?>
这构建了一个像xxxxxxx / at-p78_5.html这样的网址,其中p78是$ f1 ['url'],而5是id_articulo。
在我的htaccess中我有这个:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^iniciarsesion acceso_xxxx.php
RewriteCond %{HTTP_HOST} ^xxxx\.es$ [NC]
RewriteRule ^(.*)$ http://www.xxxx.es/$1 [R=301,QSA,L]
RewriteRule ^ce-(.+)_([0-9]+).html web_provincia.php?id=$2&url=$1 [L]
RewriteRule ^at-(.+)_([0-9]+).html web_nuevapagina.php?id=$2&url=$1 [L]
RewriteRule ^(.+)/(.+).html categoria.php?idcat=$1&url=$2 [L]
RewriteRule ^(.+).html provincia.php?url=$1 [L]
RewriteRule ^art-(.+).html nuevapagina.php?url=$1 [L]
RewriteRule ^articulo(.+)-(.+).html articulo.php?idart=$1&url=$2
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?xxxx\.es/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /no_imagen.jpe [L]
ErrorDocument 404 http://www.xxxx.es
</IfModule>
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_item_include file \.html$
mod_gzip_item_include file \.php$
mod_gzip_item_include file \.css$
mod_gzip_item_include file \.js$
mod_gzip_item_include mime ^application/javascript$
mod_gzip_item_include mime ^application/x-javascript$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include handler ^application/x-httpd-php
mod_gzip_item_exclude mime ^image/.*
</IfModule>
<Files *.css>
SetOutputFilter DEFLATE
</Files>
<Files *.js>
SetOutputFilter DEFLATE
</Files>
# Expires Headers - 2678400s = 31 days
<ifmodule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType text/html "access plus 7200 seconds"
ExpiresByType image/gif "access plus 2678400 seconds"
ExpiresByType image/jpeg "access plus 2678400 seconds"
ExpiresByType image/png "access plus 2678400 seconds"
ExpiresByType text/css "access plus 518400 seconds"
ExpiresByType text/javascript "access plus 2678400 seconds"
ExpiresByType application/x-javascript "access plus 2678400 seconds"
</ifmodule>
# Cache Headers
<ifmodule mod_headers.c>
# Cache specified files for 31 days
Header set Cache-Control "max-age=2678400, public"
# Cache HTML files for a couple hours
Header set Cache-Control "max-age=7200, private, must-revalidate"
# Cache PDFs for a day
Header set Cache-Control "max-age=86400, public"
# Cache Javascripts for 31 days
Header set Cache-Control "max-age=2678400, private"
</ifmodule>
在我的web_nuevapagina.php上,我有这个:
<?php
if (mysql_num_rows($cfila = mysql_query("SELECT * FROM landing_articulos WHERE id_articulo='" . $_GET["id"] . "' LIMIT 1"))) {
$fila = mysql_fetch_array($cfila);
echo 'Hola Prueba';
} else {
echo 'Falla';
header('HTTP/1.1 302 Moved Permanently');
header('Location: /');
exit;
}
if ($fila['url'] != '') {
$urlbuena = '/art-' . $fila["url"] . '.html';
if ($_SERVER['REQUEST_URI'] != $urlbuena) {
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $urlbuena);
}
} else {
header('HTTP/1.1 302 Moved Permanently');
header('Location: /');
exit;
}
最后,我有nuevapagina.php,我有这段代码
if (mysql_num_rows($cfila = mysql_query("SELECT * FROM landing_articulos WHERE url='" . $_GET["url"] . "' AND valido>'0' LIMIT 1"))) {
$fila = mysql_fetch_array($cfila);
} else {
header('HTTP/1.1 302 Moved Permanently');
header('Location: /');
exit;
}
if ($fila['url'] != '') {
$urlbuena = '/art-' . $fila["url"] . '.html';
if ($_SERVER['REQUEST_URI'] != $urlbuena) {
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $urlbuena);
}
} else {
header('HTTP/1.1 302 Moved Permanently');
header('Location: /');
exit;
}
那么,我该如何修复呢?它会进入根路径并且不显示我想要的内容。希望你能帮忙。感谢