Welcome to WebmasterWorld Guest from 54.147.20.131

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Need Help with redirecting print url

     

alika

12:36 pm on Aug 4, 2013 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I removed a print plugin and now the URLs are coming as 404. I need to redirect them to the correct URL

My old URLs were

www.URL.com/blog/year/month/post-title/print

I want to redirect them to their equivalent

www.URL.com/blog/year/month/post-title/

This is the htaccess I created, but it is not working. I put it in the root folder on top of everything else (not many) in the .htaccess, but no success

Am I missing something?

RewriteEngine on
RewriteRule ^(.*)/print/$ /$1 [R=301,NC,L]

phranque

11:31 am on Aug 5, 2013 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



that trailing slash in the Pattern won't match the request and for a redirect the Substitution string should be fully qualified with the canonical protocol and hostname.

also, since paths and filenames are case-sensitive on most servers, would also recommend against using the [NC] flag.

g1smd

12:47 pm on Aug 5, 2013 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



The pattern does not match the example URL.
Look at the trailing slash.

alika

2:54 pm on Aug 5, 2013 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Should it be

RewriteEngine on
RewriteRule ^(.*)/print /$1 [R=301,L]

g1smd

7:38 pm on Aug 5, 2013 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



With that code, the target URL will be missing the trailing slash.


Try this:
RewriteRule ^([^/]+/)print$ http://www.example.com/$1 [R=301,L]
 

Featured Threads

Hot Threads This Week

Hot Threads This Month