Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

HTACCESS - MOD REWRITE - HELP

Posted on 2006-11-09
2
341 Views
Last Modified: 2010-03-04
I am using a mod rewrite to convert a url w/ a query string to a more friendly format.

Example:
http://www.mydomain.com/value/index.php 
is interpereted by the server as:
http://www.mydomain.com/index.php?variable=value

The previous part is working.
The problem comes when trying to access a folder off of the web root.

Example:
http://www.mydomain.com/admin/login.php
The server is interpertiing this as:
http://www.mydomain.com/login.php?variable=admin

I need help modifying the .htaccess below to exclude certian values so I can access sub-folders.

Example:
admin
images
css
include

# Begin .htaccess
RewriteEngine on
RewriteRule ^([^/]+)/([^/]+)\.php$ /$2.php?variable=$1
RewriteRule ^([a-zA-Z0-9_-]+)$ /index.php?variable=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ /index.php?variable=$1
0
Comment
Question by:MrPickle
2 Comments
 
LVL 16

Accepted Solution

by:
HackneyCab earned 500 total points
ID: 17911011
I solved this problem for another member a few weeks ago:

http://www.experts-exchange.com/Web/Web_Languages/PHP/Q_22033545.html

You need to use a RewriteCond to check whether the directory exists before executing the RewriteRule.
0
 

Author Comment

by:MrPickle
ID: 17929794
Thanks, that was exactly what I needed.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question