Solved

PHP mod rewrite query

Posted on 2014-11-06
1
262 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 55

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 40426530
Try this

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

Open in new window

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

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.
This article discusses four methods for overlaying images in a container on a web page
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

839 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