stickynote427 Posted May 17, 2009 Share Posted May 17, 2009 I'm trying to get into .htaccess more and start out mod rewrite, but I'm having a lot of issues. Currently, I'm trying to redirect the user from a flat directory (/ex/am/ple/) to a page that has GET parameters (index.php?page=whatever). So, if someone goes to visitor/page/welcome on my site, I want them to be redirected to visitor/index.php?page=welcome. Here's what I have right now: Options +FollowSymlinks RewriteEngine on RewriteRule ^/visitor/page/(.+) /visitor/index.php?page=$1 However, I get a 404 error when trying to access a flat directory (because it doesn't exist). Any clues are appreciated. Thanks. Blake Quote Link to comment https://forums.phpfreaks.com/topic/158492-trying-to-get-started-with-htaccess-and-mod-rewrite-having-problems/ Share on other sites More sharing options...
wildteen88 Posted May 17, 2009 Share Posted May 17, 2009 Remove the / before the ^ and you rewrite rule should work. Quote Link to comment https://forums.phpfreaks.com/topic/158492-trying-to-get-started-with-htaccess-and-mod-rewrite-having-problems/#findComment-835865 Share on other sites More sharing options...
stickynote427 Posted May 17, 2009 Author Share Posted May 17, 2009 (Sorry this was in the wrong forum at first.) I removed the ^ before the / and it did not work. Quote Link to comment https://forums.phpfreaks.com/topic/158492-trying-to-get-started-with-htaccess-and-mod-rewrite-having-problems/#findComment-835929 Share on other sites More sharing options...
Ken2k7 Posted May 17, 2009 Share Posted May 17, 2009 Give this a try - Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^/visitor/page/(.+)$ /visitor/index.php?page=$1 If that fails, remove the / before visitor. Quote Link to comment https://forums.phpfreaks.com/topic/158492-trying-to-get-started-with-htaccess-and-mod-rewrite-having-problems/#findComment-835958 Share on other sites More sharing options...
stickynote427 Posted May 18, 2009 Author Share Posted May 18, 2009 :'-) Thank you so much. I did have to remove the / before the first visitor. Quote Link to comment https://forums.phpfreaks.com/topic/158492-trying-to-get-started-with-htaccess-and-mod-rewrite-having-problems/#findComment-836114 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.