en index.php me funciona pero en index.html no me tendria que hacer la redirrecion igualmente
//url inicial
//http://seophp.example.com/tema4/la-eliminacion-de-index.php/index.php
//redirecciona url
//http://seophp.example.com/tema4/la-eliminacion-de-index.php/
me sale el siguiente error
Not Found
The requested URL /tema4/la-eliminacion-de-index.php/index.html was not found on this server.
Apache/2.2.21 (Fedora) Server at seophp.example.com Port 80
el fichero se llama index.php
<?php
//redireccionar la petición actual si es necesario
require_once 'include/url_redirect.inc.php';
//redireccionar las peticiones a index.php y index.html hacia la raíz
fix_index_url();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<title>redireccion correcta</title>
</head>
<body>
<h1>redireccion correcta</h1>
</body>
</html>
el fichero se llama url_redirect.inc.php y esta dentro de una carpeta include
Código PHP:
Ver original<?php
//redireccionar peticiones a index.php y index.html hacia la raíz
function fix_index_url()
{
//si la petición se realiza para index.php redireccionamos a ./
if (preg_match('#(.*)index\.(html|php)$#', $_SERVER['REQUEST_URI'], $captures)) {
//realizar una redirección 301 al nuevo URL
header('HTTP/1.1 301 Moved Permanently'); header('Location: ' . $captures[1]); }
}
?>
dentro de la carpeta tengo un fichero que se llama config.inc.php
Código PHP:
Ver original<?php
// dominio de sitio; sin '/' final !
define('SITE_DOMAIN', 'http://seophp.example.com'); ?
>