JKG Posted September 8, 2011 Share Posted September 8, 2011 hey, i have a site which runs this as its rewrite, it works: RewriteEngine on RewriteCond %{HTTP_HOST} ^site.com$ [OR] RewriteCond %{HTTP_HOST} ^www.site.com$ RewriteRule ^/?$ "http\:\/\/www\.site\.com\/Sitename\-homepage" [R=301] RewriteRule ^Sitename-([^/]*)$ /index.php?page=$1 [L] i want to now add a redirect to this, this works but appends the orginal query string, how do i tell it not to do that? Redirect 301 /Sitename-home http://www.site.com/Sitename-homepage this rule redirects to: http://www.site.com/Sitename-homepage?page=home which isnt what i want. is there an append thats the opposite of [QSA]? thanks. Quote Link to comment https://forums.phpfreaks.com/topic/246713-htaccess-redirecting-a-rewritten-rule/ Share on other sites More sharing options...
cags Posted September 9, 2011 Share Posted September 9, 2011 Trying adding a question mark to the end of the target location. Quote Link to comment https://forums.phpfreaks.com/topic/246713-htaccess-redirecting-a-rewritten-rule/#findComment-1267257 Share on other sites More sharing options...
JKG Posted September 9, 2011 Author Share Posted September 9, 2011 hi cags, thanks for your reply. i tried it, and it does strip the url of the query string, but also displays a question mark at the end of the url, which is not ideal. i tried just putting a space but it went back to what it was doing before. any other ideas? thanks! Quote Link to comment https://forums.phpfreaks.com/topic/246713-htaccess-redirecting-a-rewritten-rule/#findComment-1267355 Share on other sites More sharing options...
cags Posted September 9, 2011 Share Posted September 9, 2011 You could try using mod_rewrite (RewriteRule) rather than mod_alias (Redirect). Quote Link to comment https://forums.phpfreaks.com/topic/246713-htaccess-redirecting-a-rewritten-rule/#findComment-1267413 Share on other sites More sharing options...
JKG Posted September 9, 2011 Author Share Posted September 9, 2011 so using RewriteCond old url rewriterule new url ? have you any idea why this is occurring, i have never come across it before... Quote Link to comment https://forums.phpfreaks.com/topic/246713-htaccess-redirecting-a-rewritten-rule/#findComment-1267419 Share on other sites More sharing options...
cags Posted September 9, 2011 Share Posted September 9, 2011 RewriteRule ^/?Sitename-home/?$ /Sitename-homepage [R=301] Quote Link to comment https://forums.phpfreaks.com/topic/246713-htaccess-redirecting-a-rewritten-rule/#findComment-1267431 Share on other sites More sharing options...
JKG Posted September 9, 2011 Author Share Posted September 9, 2011 hmm, that doesnt work at all.... thanks for your help Cags. Quote Link to comment https://forums.phpfreaks.com/topic/246713-htaccess-redirecting-a-rewritten-rule/#findComment-1267481 Share on other sites More sharing options...
cags Posted September 10, 2011 Share Posted September 10, 2011 Is the object to redirect requests for Sitename-home to Sitename-homepage before proceeding with the other rewrite rules? If so make sure you place the rule I suggested first and give it the L flag. Quote Link to comment https://forums.phpfreaks.com/topic/246713-htaccess-redirecting-a-rewritten-rule/#findComment-1267589 Share on other sites More sharing options...
JKG Posted September 10, 2011 Author Share Posted September 10, 2011 yes! thanks for sticking with me cags, much appreciated marked as solved. Quote Link to comment https://forums.phpfreaks.com/topic/246713-htaccess-redirecting-a-rewritten-rule/#findComment-1267652 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.