Avatar of cloughs
cloughsFlag for United Kingdom of Great Britain and Northern Ireland

asked on 

PHP mod rewrite query

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
PHPApache Web ServerWeb Languages and Standards

Avatar of undefined
Last Comment
Julian Hansen
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo