now I would insert a redirect in the .htaccess to make sure the unique link:
myurl.com/page-59.html
Can you help me please? Thanks
g1smd
12:55 pm on May 23, 2011 (gmt 0)
Use a RewriteRule to detect the path part and add a preceding RewriteCond looking at %{QUERY_STRING} for the query string part. Capture the page number in a backreference for use by the rule target.
It's two lines of code. What have you tried so far? There are also several thousand similar examples in this forum.
anjx
4:04 pm on May 23, 2011 (gmt 0)
Hi g1smd, thank you for your answer. I tried many codes, but I have always failed. My last try:
But I know that it is a wrong code. Please can you give me an exactly code? I do not know what to do.
Thanks
g1smd
6:41 pm on May 23, 2011 (gmt 0)
Use a RewriteRule to detect the path part. RewriteRule can see only the PATH. It cannot see the query string. Do not include the query string in the pattern.
Add a preceding RewriteCond looking at %{QUERY_STRING} for the query string part. Capture the page number in a backreference for use by the rule target.
The target URL will need the protocol and domain name and the flags will be [R=301,L].
Add a question mark right after the .html to clear the query string value then go test it.
Try single digit page numbers first, then double digit, or more.
anjx
9:40 pm on May 23, 2011 (gmt 0)
I have an error..."FORBIDDEN"
g1smd
9:53 pm on May 23, 2011 (gmt 0)
Use the Live HTTP Headers extension for Firefox to check the headers being sent by the server and the HTTP status codes.
Check the URL shown in the browser address bar.
anjx
10:19 pm on May 23, 2011 (gmt 0)
I have change the position and now the home page is working, but when try redirect I have this error:
This page is not redirecting properly Firefox has detected that the server is redirecting the request for this page so that it can never be completed. This problem is often caused by the blocking or rejection of cookies.
In the RewriteRule pattern change " . " to " \. " too.
anjx
7:59 pm on May 24, 2011 (gmt 0)
Thank you very much :)
g1smd
9:28 pm on May 24, 2011 (gmt 0)
This thread may have been long-winded but hopefully you now understand what the code actually does.
A thorough read of a guide to Regular Expressions should now be high on your list of priorities.
anjx
10:44 am on May 26, 2011 (gmt 0)
Yes, I'm agree :P
Another question if you can help me: now I would like redirect all page: example:
myurl.com/page-59.html?start=150 to myurl.com/page-59.html AND myurl.com/category/page-57.html?start=400 to myurl.com/category/page-57.html AND myurl.com/category2/page-11.html?start=375 to myurl.com/category2/page-11.html
Can you help me please..
I think: RewriteCond %{QUERY_STRING} start=([0-9]) RewriteRule ^page-([0-9]*)\.html$ (.*)/page-$1.html? [R=301,L]
If I go in http://www.example.com/page-5.html?start=400 working OK so http://www.example.com/page-5.html
but if I go in subcategory: http://www.example.com/category/page-5.html?start=400 the redirect is wrong and I have: http://www.example.com/category/page-category.html
is requested. Do you need for the second rule to have some sort of attached RewriteCond? It currently has none.
The second rule also allows exactly
http://www.example.com//page-.html
to be a valid URL as ' * ' means "ZERO or more".
Add a blank line AFTER each RewriteRule line so you can see what code goes together.
anjx
7:27 am on May 27, 2011 (gmt 0)
I have 7 categories and all have pagination with page-5.html?start=400 bug. So I need to delete in the all pages ?start=400 e redirect to page-"number".html