Solved

PHP mod rewrite query

Posted on 2014-11-06
1
249 Views
Last Modified: 2014-11-06
Hello,

How would I use mod_rewrite to redirect users from a URL as follows:

www.domain.com/folder1/index.php?contact-us

to convert this URL on the server to actually go to:

www.domain.com/index.php?contact-us

So take a URL, strip out a subfolder that appears in all queries from 1 domain name and leave the rest of the URL intact.  The bits after the index.php change so its important to take the received URL and adjust it then keep the remainder.  e.g. index.php?home and index.php?who are we  etc.

Thanks in advance
0
Comment
Question by:cloughs
1 Comment
 
LVL 51

Accepted Solution

by:
Julian Hansen earned 500 total points
Comment Utility
Try this

RewriteRule ^(.*)/index.php$ index.php [L,Q,NC]

Open in new window

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

728 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