Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Website and Server Administration Forum


You are currently viewing our Website and Server Administration Forum as a guest. Please register to participate.
Login



Reply
mod_rewrite on existing folder
Old 07-06-2011, 04:00 PM mod_rewrite on existing folder
Junior Talker

Posts: 1
Trades: 0
I have created a mod_rewrite that redirects from a particular URL to url.php and this is working properly. In this case I'm using a non-existing folder called store which means that when I try to access my application through:
/myapp/store/whatever
this will redirect me to:
/myapp/url.php

RewriteEngine on
RewriteRule ^store/([^/\.]+)/?$ url.php?store=$1 [L]

However, if I try to use the same rule on an existing folder it gives me a 404-page. So if I go to:
/myapp/whatever
I should still be redirected to /myapp/url.php

RewriteEngine on
RewriteRule ^myapp/([^/\.]+)/?$ url.php?store=$1 [L]

Can you please help me with this second rule?
emilyparker is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-23-2011, 09:09 AM Re: mod_rewrite on existing folder
L a r r y's Avatar
Super Talker

Posts: 103
Name: Larry K
Location: Arizona
Trades: 0
I'm not sure if I follow your question. So I will lay out some details as I perceive them:

At www.example.com/myapp/ the folder /myapp/ is a physical folder on disk.
At www.example.com/myapp/store/ the folder /store/ is a virtual folder.

And "whatever" is a placeholder standing in for any represented content.

Your rule works on /virtual/whatever, but fails on /actual/whatever.

I run a wiki. I was advised in the setup instructions for generating a user-friendly URL scheme at www.example.com/wiki/, not to create an actual /wiki/ folder on the disk.

That may be what you ran into when you tried to work from the actual myapps folder.

Edit: Some additional thoughts come to mind: Your rewrite rule doesn't kick in when you are following an actual folder, and the "whatever" does not exist in the actual folder. Therefore, 404.

You may need to place some conditionals and a rewrite rule to capture "whatever" that is not in /store/"whatever."
__________________
Larry
Please login or register to view this content. Registration is FREE

Last edited by L a r r y; 07-23-2011 at 09:29 AM.. Reason: Clarifications and additional info
L a r r y is offline
Reply With Quote
View Public Profile Visit L a r r y's homepage!
 
Reply     « Reply to mod_rewrite on existing folder
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.10606 seconds with 12 queries