OllieMackJames Posted July 28, 2015 Posted July 28, 2015 In my visitor stats I just found a strange string added to my url www.domain.com/name-of-page/?sa=X&ved=0CDwQ9QEwEzigAWoVChMIyOTM7sb-xgIVy-8UCh2tBwDi Here's the question: how can I get processwire to not keep the url like that? I am already working with canonical, but also want htaccess rewrite or something to take care of this. Anyone know how to do this? thanks!
OllieMackJames Posted July 28, 2015 Author Posted July 28, 2015 Found the solution: This stops access to processwire admin as well! ANybody know how to fix? Add this to your htaccess file: RewriteCond %{query_string} . RewriteCond %{THE_REQUEST} !^.*\/piwik/index\.php?(.*) RewriteRule (.*) /$1? [R=301,L]
LostKobrakai Posted July 29, 2015 Posted July 29, 2015 The backend needs GET data all over the place.
OllieMackJames Posted July 29, 2015 Author Posted July 29, 2015 The backend needs GET data all over the place. @LostKobrakai, tnx for that, just wondering what it means that GET data are use all over and how to go about it to still allow that to work through htaccess, any ideas?
OllieMackJames Posted July 29, 2015 Author Posted July 29, 2015 Tried all the following, but none allows access to my pwire named admin dir: RewriteCond %{REQUEST_URI} !(pwire) [NC] RewriteCond %{THE_REQUEST} !^.*\/pwire/page\?(.*) RewriteCond %{REQUEST_URI} !^/pwire/.*$ RewriteCond %{REQUEST_URI} !^/(pwire) [NC,OR]
Mike Rockett Posted July 29, 2015 Posted July 29, 2015 With these, it's best to tackle them one by one. For this particular one, place the following directly beneath RewriteEngine On: RewriteCond %{QUERY_STRING} ^sa=[^&]+&ved=[^&]$ [NC] RewriteRule ^(.*)$ /$1? [R=302,L] This will trim out the query string and revert to /name-of-page. 2
OllieMackJames Posted July 31, 2015 Author Posted July 31, 2015 With these, it's best to tackle them one by one. For this particular one, place the following directly beneath RewriteEngine On: RewriteCond %{QUERY_STRING} ^sa=[^&]+&ved=[^&]$ [NC] RewriteRule ^(.*)$ /$1? [R=302,L] This will trim out the query string and revert to /name-of-page. Thanks Mike, that seems to do the trick for this one. Still wondering though, I managed to get all in one go, but lost access to the admin side of pw, would anyone know how to do this. Maybe do admin on https? Site itself runs on http. Anyone any ideas? thanks!
LostKobrakai Posted July 31, 2015 Posted July 31, 2015 You could limit the removal of get parameters to just the frontend by disabling the rule for everything in the admin-backend "folder". Disabling them in the backend is a very bad idea as lots of core and 3rd party modules use them. 2
OllieMackJames Posted August 1, 2015 Author Posted August 1, 2015 You could limit the removal of get parameters to just the frontend by disabling the rule for everything in the admin-backend "folder". Disabling them in the backend is a very bad idea as lots of core and 3rd party modules use them. HI LostKobrakai, tnx for that, sounds good! Now if only I knew how to do that, can you give an example that might work? The code below blocks all get parameters, what do I need to add or change to exclude admin-backend folder? thanks! RewriteCond %{query_string} . RewriteCond %{THE_REQUEST} !^.*\/piwik/index\.php?(.*) RewriteRule (.*) /$1? [R=301,L]
LostKobrakai Posted August 1, 2015 Posted August 1, 2015 That would need an answer from someone other than me. I know that it works, but I'm a total noob when it comes to the actual syntax of those rules. 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now