Most of WordPress blogs are host on Linux/Unix servers, but some are hosting their WordPress on Windows. If we host WordPress on IIS (WordPress allow users to set permalinks on IIS with index.php in URL, this doesn’t looks pretty.), we can’t use mod_rewrite. Besides, we don’t have administrative control on shared hosting, so we can’t use ISAPI_Rewrite. However, we have right to set 404 pages, with the help of those 404 pages, we can set permalinks as we want.
What we have to do is create a 404 page, we name this page wp-404.php for example, then add the following code in this page.
<?php
$qs = $_SERVER['QUERY_STRING'];
$pos = strrpos($qs, ‘://’);
$pos = strpos($qs, ‘/’, $pos + 4);
$_SERVER['REQUEST_URI'] = substr($qs, $pos);
$_SERVER['PATH_INFO'] = $_SERVER['REQUEST_URI'];
include(‘index.php’);
?>
the second step is go to your hosting panel and point 404 page to wp-404.php, that’s all. Of course, you have to set permalinks rules at WordPress backend.
RSS Feed
Posted in
Tags: