Support

Admin Tools

#17958 URL Forwarding for 5000+ Links

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by user68806 on Wednesday, 30 October 2013 05:44 CDT

user68806
Mandatory information about my setup: Joomla 3.1 Latest Pro admin tools

Have I read the related troubleshooter articles above before posting (which pages?)? yes
Have I searched the tickets before posting? no ticket found
Have I read the documentation before posting (which pages?)? yep
PHP Built On Linux n13 3.2.6mtv13 #1 SMP Tue May 14 15:32:13 PDT 2013 x86_64
Database Version 5.1.55-rel12.6
Database Collation utf8_general_ci
PHP Version 5.3.27
Web Server Apache/2.2.22
WebServer to PHP Interface cgi-fcgi
Joomla! Version Joomla! 3.1.4 Stable [ Ember ] 25-July-2013 14:00 GMT

Description of my issue:
Hi my old site was hacked and therefore i have 5000+ bad links pointing to my site.
I need to send all links which are not exactly my new 6 pages to a 404 page. Otherwise Google will not rank me back.

The question: How exactly can i forward all incorrect, bad, incomplete links to 404 instead of 200 which is somehow the standard php or joomla setting.
I would really like to avoid adding an incomplete list of many thousends of links one by one into a htaccess file.

THANK YOU!

nicholas
Akeeba Staff
Manager
I am not sure where that "200" figure comes from. There is no hard limit, neither in Joomla! not in .htaccess. While you can add 5000+ redirections in .htaccess, the performance penalty will be so high that Google will rank you down because of bad page load times. Unfortunately there is no easy answer to your your question. You would ideally need to figure out a way to write regular expression based rewrite rules to massively redirect similar (but invalid) links to a 404 page. This is a really tough challenge and by asking me this question I understand you won't be able to do that.

Perhaps the only thing you could do is submit a sitemap to Google Webmaster Tools, therefore hinting Google that the rest of the URLs are not supposed to work.

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user68806
Hi Nicholas,

thank you for your answer.
I can narrow it down to 6 cases:
Disallow: /*?
Disallow: /?*
Disallow: /*?*
Disallow: /*%
Disallow: /%*
Disallow: /*%*

Basically everything that is not a direct and exact page url. (I have only 10 pages)
Can you tell me how that would look like in the Redirect or in the htaccess component?


user68806
Hi,

i have found the following infos:
http://stackoverflow.com/questions/14492735/how-can-i-redirect-old-pages-with-question-marks-in-the-url

It says that i can forward but with a rewrite rule. Now i have tried but it goes to server missconf. 500 Error.

I guess while it is already pretty complex in the htaccess. All admintool functions already on!
I hope you will find a solution. I am getting crazy on this.

user68806
I am no developper, but what about this?
http://httpd.apache.org/docs/2.2/rewrite/flags.html#flag_g

NE|noescape

By default, special characters, such as & and ?, for example, will be converted to their hexcode equivalent. Using the [NE] flag prevents that from happening.

RewriteRule ^/anchor/(.+) /bigpage.html#$1 [NE,R]

The above example will redirect /anchor/xyz to /bigpage.html#xyz. Omitting the [NE] will result in the # being converted to its hexcode equivalent, %23, which will then result in a 404 Not Found error condition.


Redirecting Anchors

Description:

By default, redirecting to an HTML anchor doesn't work, because mod_rewrite escapes the # character, turning it into %23. This, in turn, breaks the redirection.
Solution:

Use the [NE] flag on the RewriteRule. NE stands for No Escape.

On which one?


user68806

nicholas
Akeeba Staff
Manager
I told you it's tough to write .htaccess rules. I don't have an easy solution for you, sorry.

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user68806
Hi,

the solution is a rewrite querry carching all the strings right at the top of the htaccess file.

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!