Note that there are some explanatory texts on larger screens.

plurals
  1. POMod-Rewrite and .htaccess Problems
    text
    copied!<p>Having some issues with Mod_Rewrite. I must admit this is my first venture into the module so I could be going through something silly. I have been trying to get this to work on my own for a day or so off and on and I can not figure out why this is not working.</p> <p>I am getting the following errors:</p> <p><strong>Notice: Undefined index: Dir in D:\wamp\www\WildForFashion\Portal\Index.php on line 31</strong></p> <p>What I am trying to accomplish is to be able to have one template page (index.php) and have Mod_Rewrite change the url for me so it can be Search Friendly and to also ease coding and design.</p> <p>I was also having issues when it came to no Images / CSS files loading at all, I did read that by using an absolute url would work.</p> <p>As of right now I am working in the PORTAL directory first (which is an admin page for website maintenance) and then will be moving onto the root directory. I am not sure if I need to have one .htaccess file or two (one being in root dir, second being in portal dir).</p> <p>The DIR folder is to hold each category and page for the website like the following:</p> <pre><code>Domain.com/{CATAGORY}/{PAGE}/ ROOT / DIR / {CATAGORY} / {Page}.php Domain.com/Portal/{CATAGORY}/{PAGE}/ ROOT / Portal / DIR / {CATAGORY} / {Page}.php </code></pre> <h3>.htaccess Before</h3> <pre><code>RewriteEngine on RewriteRule ^/Portal/$ Portal/Index.php?Dir=Portal&amp;Page=Home [L,QSA] RewriteRule ^Portal/(.*)/(.*)$ Portal/Index.php?Dir=$1&amp;Page=$2 [L,QSA] RewriteRule ^Portal/(.*)/$ Portal/Index.php?Dir=$1&amp;Page=Home [L,QSA] </code></pre> <h3>.htaccess After (Working w/ Exceptions)</h3> <pre><code>RewriteEngine on RewriteRule Portal/$ Portal/Index.php?Dir=Portal&amp;Page=Home [L,QSA] RewriteRule Portal/([^/]+)/$ Portal/Index.php?Dir=$1&amp;Page=Home [L,QSA] RewriteRule Portal/([^/]+)/([^/]+)/$ Portal/Index.php?Dir=$1&amp;Page=$2 [L,QSA] </code></pre> <h3>Index.php</h3> <pre><code>&lt;?php include_once("DIR/" . $_GET['Dir'] . "/" . $_GET['Page'] . ".php"); ?&gt; </code></pre> <h3>Directory Tree</h3> <blockquote> <ul> <li>CSS</li> <li>DIR</li> <li>IMG</li> <li>JS</li> <li>SRC</li> <li>Portal <ul> <li>CSS</li> <li>DIR <ul> <li>Portal</li> <li>Inventory</li> <li>Stats</li> <li>Orders</li> </ul></li> <li>IMG</li> <li>JS</li> <li>SRC</li> <li>Index.php</li> <li>.htaccess</li> </ul></li> <li>Index.php</li> </ul> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload