I recently added a mod rewrite rule to my htaccess file to handle parsing category pages. After receiving assistance on this site the htaccess works fine. However, after I implemented the new htaccess I noticed two different conflicts/problems occurring in my script.
1] I had to change all include() functions, script links, and image sources from paths to full urls for the script to function although I added <base href="/" />
just below the <head>
.
2] Variables on included files, either through include();
or eval('?>'.file_get_contents($topad).'<?php;');
, are no longer assuming their values pre-established on the page they are being called into.
For Example:
Prior to the rewrite rule being added to the htaccess file the below form worked just fine when included using include()
... but after, though the form is being called to the page, the variables $level
and $page_url
do not assume their values.
echo '<form action="'.$level.'core/login/login.php" method="POST">';
echo '<input type="hidden" name="returnto" value="'.$page_url.'">';
echo '<div class="login-form-wrap">';
echo '<fieldset><legend>Member Login</legend>';
echo '<p>';
echo '<label>Email</label>';
echo '<input name="email" class="col_12" type="text" placeholder="Enter Email..." />';
echo '</p>';
echo '<p>';
echo '<label>Password</label>';
echo '<input name="password" class="col_12" type="password" placeholder="Enter Password..." />';
echo '</p>';
echo '<p>';
echo '<input name="submitit" type="submit" class="button radius text-center expand" value="Log In">';
echo '</p>';
echo '</fieldset>';
# forgot links
echo '<p class="center">';
echo '<span class="get-pass forgot-link" title="">Forgot Password</span> | ';
echo '<span class="go-home forgot-link" title="">Go to Home Page</span>';
echo '</p>';
echo '</div>';
echo '</form>';
If I place the form on the file it works just fine.
However...
It should be noted that the file the form is being placed on is, in and of itself, a file being called through an include();
function and though the file is called through include();
, everything works just fine.
I have no idea how to resolve this issue... your assistance is much appreciated.
Working htaccess:
# For security reasons, Option followsymlinks cannot be overridden.
#Options +FollowSymlinks -MultiViews
Options +SymLinksIfOwnerMatch -MultiViews
RewriteEngine On
RewriteBase /
# http -> https
RewriteCond %{HTTP_HOST} s8w\.org [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]
# skip files and directories from rules below
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^category/(.*)$ category.php?title=$1 [QSA,L,NC]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]
RewriteRule ^(.+)$ index.php?title=$1 [QSA,L]