Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8290103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:41:59+00:00 2026-06-08T12:41:59+00:00

Having some issues with Mod_Rewrite. I must admit this is my first venture into

  • 0

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.

I am getting the following errors:

Notice: Undefined index: Dir in D:\wamp\www\WildForFashion\Portal\Index.php on line 31

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.

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.

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).

The DIR folder is to hold each category and page for the website like the following:

Domain.com/{CATAGORY}/{PAGE}/
ROOT / DIR / {CATAGORY} / {Page}.php

Domain.com/Portal/{CATAGORY}/{PAGE}/
ROOT / Portal / DIR / {CATAGORY} / {Page}.php

.htaccess Before

RewriteEngine on
RewriteRule ^/Portal/$      Portal/Index.php?Dir=Portal&Page=Home   [L,QSA]
RewriteRule ^Portal/(.*)/(.*)$  Portal/Index.php?Dir=$1&Page=$2 [L,QSA]
RewriteRule ^Portal/(.*)/$      Portal/Index.php?Dir=$1&Page=Home   [L,QSA]

.htaccess After (Working w/ Exceptions)

RewriteEngine on
RewriteRule Portal/$     Portal/Index.php?Dir=Portal&Page=Home   [L,QSA]
RewriteRule Portal/([^/]+)/$     Portal/Index.php?Dir=$1&Page=Home   [L,QSA]
RewriteRule Portal/([^/]+)/([^/]+)/$     Portal/Index.php?Dir=$1&Page=$2 [L,QSA]

Index.php

<?php
include_once("DIR/" . $_GET['Dir'] . "/" . $_GET['Page'] . ".php");
?>

Directory Tree

  • CSS
  • DIR
  • IMG
  • JS
  • SRC
  • Portal
    • CSS
    • DIR
      • Portal
      • Inventory
      • Stats
      • Orders
    • IMG
    • JS
    • SRC
    • Index.php
    • .htaccess
  • Index.php
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T12:42:02+00:00Added an answer on June 8, 2026 at 12:42 pm

    You are including forward slashes in the matching rule that don’t need to be there and excluding them from the redirect path where they do need to be. Try this:

    RewriteRule Portal/$      Portal/Index.php?Dir=Portal&Page=Home   [L,QSA]
    
    RewriteRule Portal/(.*)/(.*)$  Portal/Index.php?Dir=$1&Page=$2 [L,QSA]
    
    RewriteRule Portal/(.*)/$      Portal/Index.php?Dir=$1&Page=Home   [L,QSA]
    

    Note I removed the ^ from the matching portions of the rewrite rules as this indicated taht should be the beginning of the URI. I also removed the “/” in front of the substritution pattern.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having some issues with C. I have this is my code: // First line
I am having some issues passing commands through to flash from javascript. My code
I'm having some issues to deserialize a Json array that follows this format: [
Having some issues getting this MPMoviePlayerViewController to work. I have two sample URLs pointing
I'm developing a Wordpress plugin, and I'm having some issues with $_SERVER['HTTP_HOST'] . This
Having some issues running my code local. I have host file setup like this:
I'm having some issues with my javascript on a particular page. This is very
Having some issues with this search engine I am trying to put together. I'll
I having some issues with converting a large byte[] array into a strongly typed
I am having some issues with the TRichEdit. The first issue is if I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.