Forum Moderators: phranque
http://www.domain.com/news/1234/the-content-of-the-new?fb_comment_id=1234567890 http://www.domain.com/news/1234/the-content-of-the-new RewriteCond %{REQUEST_URI} ^/news/.*$
RewriteCond %{QUERY_STRING} ^fb_comment_id.*$
RewriteRule ^(.*)$ $1? [R,L] RewriteRule ^news/([^/]+).*$ new.php?id=$1 [L] http://www.domain.com/new.php?id=1234 http://www.domain.com/news/1234/the-content-of-the-new
RewriteCond %{QUERY_STRING} ^fb_comment_id
RewriteRule ^(news/.*) http://www.example.com/$1? [R=301,L] Should I add a R=301 to this rewrite?:
But in the .htaccess there is also this rule:
RewriteRule ^news/([^/]+).*$ new.php?id=$1 [L]
So the url converts to:
http://www.example.com/new.php?id=1234
The main issue was that I had to write a full url string with protocol and hostname in the rewrite rule.
RewriteCond %{QUERY_STRING} ^fb_comment_id
RewriteRule ^(news/.*) http://www.domain.com/$1? [R=301,L]
RewriteRule ^news/([^/]+).*$ new.php?id=$1 [L] http://www.domain.com/news/1234/the-content-of-the-new?fb_comment_id=1234567890 http://www.domain.com/news/1234/the-content-of-the-new