Page 2 of 2
Re: HTACCESS - can you set two rules? ending in / and not ?
Posted: Tue Jul 09, 2013 4:15 am
by requinix
Same way you'd do normal URL rewriting except using a [R=301].
Re: HTACCESS - can you set two rules? ending in / and not ?
Posted: Tue Jul 09, 2013 4:18 am
by simonmlewis
Sorry I really don't know.
Trust me, if I knew, I'd have done it.

Re: HTACCESS - can you set two rules? ending in / and not ?
Posted: Tue Jul 09, 2013 5:05 am
by requinix
You've been doing them all along...
Code: Select all
DirectoryIndex index.php index.html index.htm
order allow,deny
allow from all
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteRule ^categ/([0-9]+)/([^/]+) /index.php?page=categ&c=$1&cname=$2&menu=sub [L]
RewriteRule ^([^/\.]+)/?$ index.php?page=$1&menu=home [L]
RewriteRule ^$ index.php?page=home&menu=home [L]
I gave you something quite close: change it so it substitutes an actual URL you want to use (rather than the "-" which means leave it unchanged) and use [R=301] to make it redirect externally rather than rewrite internally.
Re: HTACCESS - can you set two rules? ending in / and not ?
Posted: Tue Jul 09, 2013 5:16 am
by simonmlewis
Ok look, I've no idea.
I have tried so many things to point it to a URL and it never seems to work.
I was going to offer some suggestions, but on checking your 401 version, I cannot see how to point it to another URL.
IE.
This doesn't work.
Re: HTACCESS - can you set two rules? ending in / and not ?
Posted: Tue Jul 09, 2013 12:47 pm
by requinix
That's it. But you still have to include the [R=301] that I've mentioned a few times now.
Re: HTACCESS - can you set two rules? ending in / and not ?
Posted: Tue Jul 09, 2013 1:52 pm
by simonmlewis
Sorry? So that line is correct - but if it is, why do I need 301 as well?
Incidentally, if the URL is still too long, it fails. So I guess I need something that stops that.
ie.: /selector&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred&catname=fred
If someone spams us with that, it logs an error.
Re: HTACCESS - can you set two rules? ending in / and not ?
Posted: Tue Jul 09, 2013 5:19 pm
by requinix
[R] tells mod_rewrite to change its usual behavior of just rewriting the URL internally (so Apache looks for files somewhere else) without doing any kind of redirection for the user. Typically [R] is for redirecting only, like using the 301, 302, or 307 HTTP status codes, but you can actually make it send any status code you want - 404, 500, whatever.
I guess that error happens before mod_rewrite can act. I don't know off the top of my head any way to prevent that from logging so I'd just Google the error message.
Re: HTACCESS - can you set two rules? ending in / and not ?
Posted: Tue Jul 09, 2013 5:35 pm
by simonmlewis
I have - didn't get a good idea of the issue, so came here to ask experts.
Re: HTACCESS - can you set two rules? ending in / and not ?
Posted: Tue Jul 09, 2013 8:39 pm
by requinix
I'm not seeing any way you can work around it, which I'm not too surprised about because typically these things are caused by faulty redirections.
I'd just let it go. You're aware of the problem, and Google is getting non-200s (403s I bet) so they'll stop hitting the pages eventually.
Re: HTACCESS - can you set two rules? ending in / and not ?
Posted: Wed Jul 10, 2013 1:47 am
by simonmlewis
So...
Forbidden
You do not have permission to access this document.
This is accepting for this page is it?
I assume Google therefore won't see it, and this won't cause anything in the Error Logs?
We'd love to point them to our personal error page, which is ..../error.
But if that cannot be done.....
Re: HTACCESS - can you set two rules? ending in / and not ?
Posted: Wed Jul 10, 2013 3:04 am
by simonmlewis
...(36)File name too long: access to /selector&catname...
Sadly we are still getting these in our error logs.
Re: HTACCESS - can you set two rules? ending in / and not ?
Posted: Wed Jul 10, 2013 4:16 am
by requinix
Right. You'll keep getting them until Google stops crawling the pages. Which it should because it doesn't keep pages that 403.
Re: HTACCESS - can you set two rules? ending in / and not ?
Posted: Wed Jul 10, 2013 4:20 am
by simonmlewis
Gotchya.
I'd like to know why it's crawling pages that don't even exist tho - and haven't existed for over a year.
Though perhaps people are posting out URLs that don't exist, just to spam us, hoping Google will try it on.
So there is no way to take users to a custom page like /error, if a "Filename is too long" ?
Re: HTACCESS - can you set two rules? ending in / and not ?
Posted: Wed Jul 10, 2013 12:37 pm
by requinix
An ErrorDocument for 403 should take care of that.
Hmm... Maybe you can make that be a PHP script that does a
to hopefully "override" the 403.
And there's also their Webmaster Tools. You can probably get that URL (or /selector* URLs) removed from the list. And on that note, try adding it to a robots.txt too.