Forum Moderators: phranque
Example:
www.mydomain.com/post/###/1
needs to redirect to:
www.mydomain.com/post/###
Here is what I have so far that handles the rewrites:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^post/([0-9]+)/$ view-article.php?id=$1
RewriteRule ^post/([0-9]+)$ post/$1/ [R]
RewriteRule ^post/([0-9]+)/([0-9]+)/$ view-article-page.php?id=$1&p=$2
RewriteRule ^post/([0-9]+)/([0-9]+)$ post/$1/$2/ [R]
</IfModule>
Any help would be greatly appreciated!
RewriteEngine On
RewriteBase /
#
# If search engine request, redirect page-numbered request (with or without trailing slash) to article-only URL
RewriteCond %{HTTP_USER_AGENT} Googlebot¦Slurp¦msnbot¦Teoma [NC]
RewriteRule ^post/([0-9]+)/([0-9]+)/?$ http://www.example.com/$1/ [R=301,L]
#
# Redirect to fix missing trailing slashes for "post" requests at any "depth"
RewriteRule ^post/(([0-9]+/)*[0-9]+)$ http://www.example.com/post/$1/ [R=301,L]
#
# Redirect to fix requests for non-canonical domain name
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
#
# Internally rewrite static URLs to view-article script
RewriteRule ^post/([0-9]+)/$ view-article.php?id=$1
RewriteRule ^post/([0-9]+)/([0-9]+)/$ view-article-page.php?id=$1&p=$2
Replace the broken pipe "¦" characters above with solid pipe characters before use; Posting on this forum modifies the pipe characters.
Jim