Solved

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

Posted on 2014-12-10
2
143 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
ID: 40495204
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

If I have to fix slow responding website my first thoughts are server side optimizations: the database may not be optimized or caching is not enabled, or things like that. We often overlook another major part of our web application: the client. We o…
A publishing tool, a Version Control System, or a Collaboration Platform! These can be some of the defining words for the two very famous web-hosting Git repositories: Bitbucket and Github. Git is widely used amongst the programmers and developers f…
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

832 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