htaccess help

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
Instead of using htaccess you could just add a bit of code to the top of index.php

PHP:
<?php
if ($_GET['page'] == 'home') {
header("location:home.html");
}
?>
 
Last edited:

albertdiones73

New Member
Messages
5
Reaction score
1
Points
0
RewriteCond %{QUERY_STRING} ^page\=home(\&.+)?$
RewriteRule ^index.php$ test.php


Or if ever you want to preserve the $_GET 's

RewriteCond %{QUERY_STRING} ^page\=home(\&.+)?$
RewriteRule ^index.php$ test.php?%{QUERY_STRING}


Then on .htaccess it'll look something like this

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteCond %{QUERY_STRING} ^page\=home(\&.+)?$
RewriteRule ^index.php$ test.php?%{QUERY_STRING}

</IfModule>
 

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
You can use HTML to redirect home.html. In between <head> and </head> type this:

Code:
<meta http-equiv="refresh" content="0;url=index.php?p=home">

So, in your entire document, it might look like this:
Code:
<html>

<head>
<title>My Website</title>
<meta http-equiv="refresh" content="0;url=index.php?p=home">
</head>

<body>
</body>

</html>
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
You can use HTML to redirect home.html. In between <head> and </head> type this:

That method is both inefficient (user makes two requests for one page) and does not scale.

Code:
RewriteBase /
RewriteRule ^([^/]*)\.html$ index.php?p=$1 [NC QSA]

Should work.
 
Top