ukweb Posted February 14, 2010 Share Posted February 14, 2010 Hi all I've been given the task of redoing the work web site, and all has gone swimmingly, with the exception of some rewrites to new locations. The last chunk doesn't work though! any help would be received with appreciation Ste RewriteEngine on Options +FollowSymLinks RewriteCond %{HTTP_HOST} ^uspcreative.com RewriteRule (.*) http://www.uspcreative.com/$1 [R=301,L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/ RewriteRule ^index\.php$ http://www.uspcreative.com/pages/news [R=301,L] RewriteRule ^pages/([^/\.]+)$ index.php?page=$1& [L] RewriteRule ^archives/([^/\.]+)$ index.php?month=$1& [L] RewriteRule ^clients/([^/\.]+)$ index.php?client=$1& [L] RewriteRule ^work.php$ http://www.uspcreative.com/pages/work [R=301,L] RewriteRule ^news.php$ http://www.uspcreative.com/pages/news [R=301,L] RewriteRule ^other.php$ http://www.uspcreative.com/pages/other [R=301,L] RewriteRule ^people.php$ http://www.uspcreative.com/pages/people [R=301,L] RewriteRule ^news_archive.php?month=1$ http://www.uspcreative.com/archives/1 [R=301,L] RewriteRule ^news_archive.php?month=2$ http://www.uspcreative.com/archives/2 [R=301,L] RewriteRule ^news_archive.php?month=3$ http://www.uspcreative.com/archives/3 [R=301,L] RewriteRule ^news_archive.php?month=4$ http://www.uspcreative.com/archives/4 [R=301,L] RewriteRule ^news_archive.php?month=5$ http://www.uspcreative.com/archives/5 [R=301,L] RewriteRule ^news_archive.php?month=6$ http://www.uspcreative.com/archives/6 [R=301,L] RewriteRule ^news_archive.php?month=7$ http://www.uspcreative.com/archives/7 [R=301,L] RewriteRule ^news_archive.php?month=8$ http://www.uspcreative.com/archives/8 [R=301,L] RewriteRule ^news_archive.php?month=9$ http://www.uspcreative.com/archives/9 [R=301,L] RewriteRule ^news_archive.php?month=10$ http://www.uspcreative.com/archives/10 [R=301,L] RewriteRule ^news_archive.php?month=11$ http://www.uspcreative.com/archives/11 [R=301,L] RewriteRule ^news_archive.php?month=12$ http://www.uspcreative.com/archives/12 [R=301,L] AddHandler php5-script .php The bits that dont work are the redirects for the news_archive.php page Quote Link to comment https://forums.phpfreaks.com/topic/192023-my-rewrites-work-fine-with-the-exception-of-the-last-few/ Share on other sites More sharing options...
cags Posted February 14, 2010 Share Posted February 14, 2010 Since no regex is being used... RewriteRule ^work.php$ http://www.uspcreative.com/pages/work [R=301,L] RewriteRule ^news.php$ http://www.uspcreative.com/pages/news [R=301,L] RewriteRule ^other.php$ http://www.uspcreative.com/pages/other [R=301,L] RewriteRule ^people.php$ http://www.uspcreative.com/pages/people [R=301,L] Would probably be better off as... Redirect 301 old new The reason your rule isn't working is because I believe RewriteRule doesn't match query strings so although your trying to compare ?month=x, the query string isn't passed to the RewriteRule. You will need to use a RewriteCond %{QUERY_STRING} month=1 for each rule (I think, haven't tested that, so syntax might not be 100% perfect. Quote Link to comment https://forums.phpfreaks.com/topic/192023-my-rewrites-work-fine-with-the-exception-of-the-last-few/#findComment-1012092 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.