How to Rewrite URL

Today, with more way to SEO your site on top keywords google, such as: Keywords marketing, Google adwords, …So, if you dont want to spent a lot of money for that, you can use yourseft for SEO by this way after:

Create file name like : redirect.php with contents:

<?php
$link=$_GET["id"];
if ($link==”")
{?>
<script language=”JavaScript”>
self.location.href=’http://domain/trangchu.php’>’;
</script>
<?php
}
else
{ ?>
<script language=”JavaScript”>
self.location.href=’http://domain/?<?php echo $link?>’;
</script>
<?php }?>

Create 1 File .htaccess with contents.

RewriteEngine On
Options +Followsymlinks
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.* - [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ /redirect.php?id=$1 [L]

Save as and upload on your server. Done.

Related Articles

Random Articles

  • Post a Comment