DataRater Posted October 14, 2011 Share Posted October 14, 2011 Please help me. I'm using Apache 2 and PHP 5 I want to redirect a URL straight over to a php script and take everything after the web address as a parameter to the php file. So I'm trying to do this and it doesn't work. RewriteRule ^([./]*)$ /XYZxyz.php?url=$1 [R=301,QSA,L] e.g. www.Website.com/News will send ---> XYZxyz.php?url=News another example www.Website.com/News/Today will send ---> XYZxyz.php?url=News/Today Please help me work out the ReWrite rule. Best wishes Stephen Quote Link to comment https://forums.phpfreaks.com/topic/249136-redirect-from-url-to-php-script/ Share on other sites More sharing options...
cags Posted October 14, 2011 Share Posted October 14, 2011 Try it without the character set, i.e. remove the square brackets from the regex, so it is just ^(.*)$ Quote Link to comment https://forums.phpfreaks.com/topic/249136-redirect-from-url-to-php-script/#findComment-1279422 Share on other sites More sharing options...
DataRater Posted October 14, 2011 Author Share Posted October 14, 2011 I've got this working RewriteRule ^([^./]*)$ /XYZxyz.php?url=$1 [QSA,L] It is working with www.Website.com/News Tomorrow I'll see if the following works. www.Website.com/News/Today will send ---> XYZxyz.php?url=News/Today Quote Link to comment https://forums.phpfreaks.com/topic/249136-redirect-from-url-to-php-script/#findComment-1279440 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.