|
Posted by Stephen Kay on 09/27/18 11:43
> If you're running Apache, you could use a rewrite rule to redirect all
> requests for .html files which exist like this:
>
> RewriteEngine On
> RewriteCond /var/www/docroot%{REQUEST_URI} -f
> RewriteRule .* /var/www/docroot/fancy.php [L,NS]
>
> (untested, btw)
>
> and in fancy.php look at the $_SERVER["REQUEST_URI"] variable to get the
> name of the HTML which was requested. The RewriteCond will ensure the PHP
> is only called when the page exists. If you want to have 404 messages, you
> can remove that line, and maybe check for just .html. Personally, I have
> all requests for non-existing files going through a PHP file, to handle
> site-wide database connections, templates, etc.
Thanks dave -
> What server are you using?
> If you are using apache then you can use RewriteRule ... It will do exactly
> what you are after.
>
> RewriteRule ^([^/]+)/([^/]+).html$ /dopage.php?p=$1 [L]
>
> Then you can worry about what dopage.php actually does.
Thanks Simon -
I'll check them out!
--
Stephen Kay
Karma-Lab sk@karma-lab.NOSPAM.com
^^^^^^^
Navigation:
[Reply to this message]
|