Rewrite all calls to a file in root

Posted on 2004-08-21
Last Modified: 2010-04-20
hello experts,

I'd like to know if its possible to use mod_rewrite to rewrite a call to say to

my ideas were

RewriteRule ^/script\.php(.*)-[L]
RewriteRule ^(.*)/script\.php?path=$1

but I only get a 500.

any ideas?
Question by:liquidblaze
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
  • 3
LVL 23

Expert Comment

ID: 11877789

look at will get some idea ..

LVL 23

Accepted Solution

rama_krishna580 earned 300 total points
ID: 12120076
Here is some example...

# to
RewriteEngine On
# Extract the subdomain part, it will be stored into %1
# [^.]+ means: match all characters except the dot
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com$ [NC]
# We make sure it's not the main host, ie
RewriteCond %1 !^www$ [NC]
# Check to avoid internal endless loops
RewriteCond %{REQUEST_URI} !^/file\.php$ [NC]
# Let's go and make an internal redirection
# by redirecting
# to
RewriteRule ^([^/]+)/[^.]+\.php$ /$2.php?site=%1&lang=$1 [QSA,L]


Author Comment

ID: 12166956
yes. that will work out. sorry for the long response time. added 50 points as an excuse :)
LVL 23

Expert Comment

ID: 12166981

Nice to hear you have solved your problem,

Best of luck..

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
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 …
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

739 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