-
- 151 Posts
i have friendly urls
and google have indexed this
my domain .co.uk/?referrer=cssbased.com
i want /?referrer=cssbased.com
to return an error so google wont index it,
any ideas?
-
- 151 Posts
I dont have this that page to add the rel too ! the referer url is added by the website cssbased automatically they are linking to my site using it ...
-
- 151 Posts
I need to make the friendly urls give an error for every url with a ? in it !
mydomain.com/? doesnt give an error but mydomain.com/X does
Do what? So in other words, you want to strip all query strings from public requests to your site? You’ll have to write a plugin to redirect such requests without the query string, or modify the mod_rewrite rules to ignore all query string parameters (removing the QSA will prevent rewritten URLs from appending the query string sent in the request). But that will break any component that depends on $_GET parameters...
-
- 151 Posts
i use friendly urls so all my urls are like mysite.com/aboutus mysite.com/contact urls like mysite.com/iuifeo obviously work and return the error page which is all good. BUT if you go to mydomain.com/? or mydomain.com/?andthinghere it just stays in the home page and doesn’t goto the error page....
What can you suggest to get pretty much every url starting /? redirect to the error document !
Understand?
Thanks.
-
- 1,611 Posts
That’s a very odd request, but you could certainly do it in .htaccess if you really want to (read up on .htaccess rewiting
here or Google it for tons of info).
-
- 151 Posts
ive tried 301 redirects and re write rules in httacess thats the first thing i tried but none worked ! as i said this place is the last resort lol why does modx allow /? and not /test in friendly urls !
if you must know why i need this, goto google and search for hostpixel then you will see my problem !
-
- 1,611 Posts
I’m not sure what you mean about MODx allowing /? and not /test in friendly urls... People using friendly URLs often still need to pass variables in the $_GET array (in the URL query string), so completely eliminating question marks would break a lot of common scripts. And it certainly allows the latter URL (/test), assuming you have a page with the alias "test".
So anyway it seems like a bad idea to me to try to forward all pages with question marks in the URL to an error page, but you can do it if you really want to (although why not make your rule more specific to the link you want to change so as not to break everything?). Just make sure that your rewrite rule is before the default MODx one, and that it’s the last rule executed (and of course that you’re matching the query string, not the URL itself). Check your syntax, because it sounds to me as if this should work in .htaccess if you do it properly.
Although you probably should just add this to your robots.txt file, no? That way search engines won’t index it, but it will still work as a page if people click on it. I wouldn’t think you’d want this link to just stop working for actual visitors, would you?