Jump to content

RewriteRule ^(.*)$ index.php?it=$1 [L,QSA]


Recommended Posts

Posted

Hello, I have several times discussions with the seo guys about urls in processwire. There are some which are valid with the regular url and also with domain.xx/index.php?it=

What do you think about this? Is it possible to redirect the "domain.xx/index.php?it=" url to a "seo-friendlier" url?

I have this within several projects.

Posted

Hi,

Where are those URLs in the form domain.xy/index.php?it come from? Because you shouldn't see this form. It's used internally by ProcessWire to handle the request from a "normal" url that is made from one or several page names.

Posted

Hi Wanze,

I myself never saw those URLs but sistrix whines about it. Every page has a canonical tag with the right URL and every page has a redirect to one domain and one hostname but sistrix says it finds duplicate content. I'll ask the seo guy tomorrow for more details.

Posted

I'm guessing that some new rewrite rule the SEO guys added caused it to start using those ?it= URLs, revealing them when it usually wouldn't. For instance, maybe they setup a rewrite rule that makes /index.php redirect to "/" without getting it quite right, thereby interfering with PW's own rewrite rules. I would suggest removing whatever rule they added that's causing the interference, and then putting your own alternative in a /site/ready.php or /site/templates/_init.php (if using one), like this:

if(preg_match('/(index\.php|[?&]it=/!', $_SERVER['REQUEST_URI'])) {
  throw new Wire404Exception();
}

Or if you just want to make it redirect to the homepage, replace the exception line with $session->redirect($config->urls->root); I will add something similar to the core ProcessPageView module to prevent that possibility too.

  • Like 4

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...