Solved

HTACCESS - MOD REWRITE - HELP

Posted on 2006-11-09
2
321 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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

929 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now