Solved

Implementing url rewriting using .htaccess file without affecting $_SERVER['SCRIPT_NAME']

Posted on 2014-12-10
2
136 Views
Last Modified: 2014-12-27
Dear All,

I want to setup a SaaS(Software as a Service) version of my ERP product. Each of the user who purchases the product can access the product using a url which will be specific for each user (For Example: http://erp.com/user1/). But there will not be a physical folder created for each user, it will be a virtual one and there will be a single copy of the program file will be there and which will be in the root directory.

I have tried with a htaccess file and here with include the code i have written, it is not generic solution it will work only for the case of 'folder1'
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^folder1/(.*)$ /$1 [QSA]
</IfModule>

The problem is when I implement the $_SERVER['SCRIPT_NAME'] returns  'http://erp.com/', instead of this i need to get 'http://erp.com/folder1/' also please suggest me a generic solution for the problem.

Thank you.
0
Comment
Question by:Jacobbaby
2 Comments
 
LVL 50

Accepted Solution

by:
Steve Bink earned 500 total points
Comment Utility
You'll need to send that information some other way.  For example:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/?([^/]+)/(.*)$ /$2?actual_folder_name=$1 [QSA]
</IfModule> 

Open in new window

In that example, the folder's name will be available as $_GET['actual_folder_name'].
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

New Relic: Our company recently started researching several products to figure out what were the best ways for us to increase our web page speed and to quickly identify performance problems that we may be having. One of the products we evaluated wa…
Foolproof security solutions has become one of the key necessities of every e-commerce or Internet banking website. If you too own an online shopping site then its vital for you to equip your web portal with customer security features that can allow…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

772 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

12 Experts available now in Live!

Get 1:1 Help Now