I'm new to coding Clean URLs, although my educated guess on how they work has been correct.
My first step was to create a compatibility tool to test if mod_rewrite is enabled on the server. I was successfully able to create the three files I needed: the PHP tool file, the .htaccess file and a file URL to be rewritten.
A basic RewriteRule is in place and when I go to the rewritten URL, it successfully redirects. However, upon trying to reference the rewritten URL either by using a PHP INCLUDE/REQUIRE or even a FILE_EXISTS function, it returns unsuccessfully. Is this not possible or am I going about this the wrong way?
I'll be happy to post code if necessary (I'm writing this from my smartphone), but right now I'm still trying to determine if it's even possible and what the best method is to accomplishing it if so.
.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule .*rewrite_test\.php rewrite.php [nc]
</IfModule>
rewrite.php:
<?php
$mod_rewrite = TRUE;
echo "test";
?>
tester.php:
<?php
// Check if APACHE MOD_REWRITE is enabled for clean URLs
$mod_rewrite = file_exists('rewrite_test.php');
echo ($mod_rewrite ? "TRUE" : "FALSE");
?>
or tester.php code alternative:
<?php
// Check if APACHE MOD_REWRITE is enabled for clean URLs
$mod_rewrite = FALSE;
include_once('rewrite_test.php');
echo $mod_rewrite;
?>
include/requirehave to do with URL rewriting? Are you trying to include URLs? This is usually disabled by default PHP configuration.FILE_EXISTSdidn't return it, I thought I'd try using anINCLUDEand returning a boolean variable. Apparently that doesn't work. Thanks ;)apache_get_modules