Jump to content

301 Redirect Issue with Processwire (Possibly?)


YYHMedia
 Share

Recommended Posts

So I'm just about finished up migrating a large drupal site to processwire.

I'm now testing some redirects and ran into an interesting problem that --might-- have something to do with processwires default .htaccess file.

So I have a main site

example.com

And a subdomain

products.example.com (apache hosted out of /public_html/products/....)

(and a few other subdomains all in wordpress incidentally).

I need a redirect like:

http://example.com/products/productname.html -> http://products.example.com/productname.html

So I tried something like the following at the top level domain .htaccess:

#othersub
RedirectMatch 301 ^/other/(.*) https://other.example.com/$1 (this works and is a WP site)
 
 
# Complicated Subdomain Redirects
RedirectMatch 301 ^/products/(.*) http://products.example.com/$1 
(this is the PW site and it instead gives me http://products.example.com/productname.html?it=products/productname.html) - which is incorrect.
 
This is either an easy processwire issue for someone who knows the .htaccess file well - or it's a server configuration thing from the subdomain and the url "folder" having the same name.  But I've tried just about every possible variation I can think of and cannot get this to work.
 
Any guidance would be appreciated.  Thanks!
 
 
 
 
Link to comment
Share on other sites

This is solvable by using Jumplinks, but especially if there's a potential of a lot of traffic, redirect at .htaccess level would be more efficient. Jumplinks is flexible and easy to use, but the downside is that the whole system has to be started just to realise that "oh, this request doesn't belong to this site at all". Waste of time and resources, really :)

Never seen this particular issue, but it sounds like you're, perhaps, doing this at the end of your .htaccess file, or something like that? The .htaccess file adds ?it=... and in a case like this that part of it shouldn't run at all. As a first step I'd try moving this as close to the beginning of the .htaccess file as possible.

This is a simple redirect, so it's quite likely that the issue is something simple too :)

  • Like 1
Link to comment
Share on other sites

Jumplinks wouldn't work because the problem was one level up (i.e. before processwire).  For what's it worth I "fixed" this by adding a near duplicate redirect after noticing what appeared after it= - namely the name of the subdirectory was removed so

at the top level - yinyanghouse.com

RewriteRule ^theory/herbalmedicine/(.*) https://theory.yinyanghouse.com/theory/herbalmedicine/$1 [R=301,L]
 
 
So in the pw .htaccess I added:
RewriteRule ^herbalmedicine/(.*) https://theory.yinyanghouse.com/theory/herbalmedicine/$1 [R=301,L]
which picks up the part that was being passed "incorrectly" and passes it "correctly".
 
So now
correctly goes to:
(the processwire part of my site)
 
Strange but it works....
 
 
Link to comment
Share on other sites

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
 Share

×
×
  • Create New...