Wordpress permalink issues with purlcode

I am trying to get a test/demo page working on a wordpress installation. The /wp/permalink?_purl=xyz code works but trying to get /wp/permalink/xyz to work doesn't (404 error).

I have tried following the instructions here: http://support.purlhub.com/customer/p... but going to a page named demo/xyz gives me a server 500 error. Is one supposed to set up an URL template and ACL rule for the demo link (that doesn't really exist) and will be redirected?

My .htaccess code looks like this (having followed the instructions on that page):
# BEGIN WordPress

RewriteEngine On
RewriteBase /wp/
RewriteRule ^demo/.* /wp/personalised-urls-purls/ [P,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]

# END WordPress
1 person has
this question
+1
This topic is no longer open for comments or replies.
  • Try changing the RewriteRule to:

    RewriteRule ^lp/.* /personalised-urls-purls/ [P,L]

    for a url like http://www.websites.com/lp/{purCode}

    The RewriteRule interprets the /lp/ in your url and redirects it to the /personalised-urls-purls/ directory. I also added a second URL format to your campaign: http://severnworks.co.uk/lp/personalised-urls-purls/{purlCode}. This makes testing and data export simpler.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • Joel Bair (purlHub Specialist) February 07, 2015 18:37
    Rebecca,

    Your wordpress installation appears to be somewhat unique. The instructions contained in http://support.purlhub.com/customer/p... specifically apply to the Apache HTTP server using mod_php5 and a typical wordpress installation.

    The specific web server virtual host configuration, along with the directory location that wordpress was installed in dictates the .htaccess specifics.

    I believe your problem may stem from the use of /wp/ in the .htaccess but I cant tell for sure, without looking at the rest of the server config.

    Assuming that your web server is an Apache server, and the host configuration sets the DocumentRoot to {some-full/path}/ and the DirectoryIndex is wp/index.php and wordpress is installed in {DocumentRoot}/wp/ and the .htaccess file is located in the {DocumentRoot} directory

    Then a working .htaccess configuration should look like this.

    # BEGIN WordPress

    RewriteEngine On
    RewriteBase /wp/

    # wordpress purl LP rule (demo/JoeUser3z )
    RewriteRule ^demo/.* /wp/personalised-urls-purls/ [P,L]

    # wordpress purl LP rule (lp/JoeUser3z )
    RewriteRule ^lp/.* /wp/personalised-urls-purls/ [P,L]

    # pass through rule
    RewriteRule ^wp/index\.php$ - [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /wp/index.php [L]

    # END WordPress
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • I’m thankful
    Thank you Theron and Joel for such quick replies, and on a Saturday too! Much appreciated.

    The server we are using is indeed Apache, and wordpress is installed in a subdirectory under the main one /wp/. Other than that it should be fairly normal. There was a .htaccess file under the /wp/ installation, and a .htaccess under the main catalogue which I had missed. So I cut and pasted what you gave me to both of them - hope that wasn't overkill!

    I am a bit confused by the lp you put in there, Theron - did you mean wp?

    So far I am still getting a 500 when I go to /wp/demo/JoeUser3z. It is probably easier if I show you the landing page I have and what I am trying to do:

    http://www.severnworks.co.uk/wp/perso...

    Right at the bottom is a little form to enter first and last name, and see it appear on the same page when submitted. So the page now is submitting to itself, and thus reloads as /wp/personalised-urls-purls/{purlcode} and gives a 404. If I change it to point to /wp/demo/{purlcode} it gives a 500.

    I am sure it is only a little something I have missed but this is all outside my usual territory so thanks for helping! Your product looks really great, I am looking forward to working more with it.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • Joel Bair (purlHub Specialist) February 08, 2015 16:26
    Rebecca,

    You should certainly not have added those rules to both .htaccess files. In your case, the /.htaccess should be left as is - in its original. The /wp/.htaccess is where you want to apply purlHub's WP rewrite rules.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • Joel Bair (purlHub Specialist) February 11, 2015 18:23
    By inspecting the HTTP response from http://www.severnworks.co.uk/wp/ - you appear to be using Wordpress on a LiteSpeed server.

    http://www.severnworks.co.uk/wp/ returns the following response headers:

    Connection: close
    Content-Encoding: gzip
    Content-Type: text/html; charset=UTF-8
    Date: Wed, 11 Feb 2015 00:44:47 GMT
    Link: ; rel=shortlink
    Server: LiteSpeed
    Transfer-Encoding: chunked
    Vary: Accept-Encoding
    X-Pingback: http://www.severnworks.co.uk/wp/xmlrp...
    X-Powered-By: PHP/5.4.34

    LiteSpeed claims to bee a drop in replacement for Apache. But obviously it has some peculiarities, and is not compatible with the Apache .htaccess example. Specifically, our .htaccess example relies on Apache's mod_proxy for internal proxied rewrite. LiteSpeed does not support this. The solution is to handle the URL rewrite within Wordpress.

    We've updated our Wordpress Integration guide and in this case recommend using the wordpress plugin rewrite. https://wordpress.org/plugins/rewrite/

    Try reverting the .htaccess changes you;ve made and using Method #1 (Wordpress plugin) from the guide here - http://support.purlhub.com/customer/p...
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • Fantastic help, thanks a lot. I will give it a try and let you know how I get on. I will warmly recommend Purlhub in the future, best customer service attitude I have met for a long time!
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • Hi, well the plugin and your help worked great and I have the page reloading to itself with the purlcode attached once the form is submitted.

    However now there is an issue in that the data isn't being served to the page as I had hoped. I looked in the console and saw this going on:

    Upon loading
    http://www.severnworks.co.uk/wp/perso...

    purlCode: P955cm8q6v
    Detected via browser cookie extraction.
    purlServiceApi.min.js?vz=1510:4
    purlService initialized.
    purlServiceApi.min.js:4
    purlService DOM setup complete.
    api.purlhub.com/JSAPI/purlTrackingApi.min.js?vz=1510:4
    purlTracker initialized.
    purlServiceApi.min.js:4

    onPurlLoadError: Permission Denied!!!
    api.purlhub.com/JSAPI/purlTrackingApi.min.js?vz=1510:4

    401 - Unauthenticated Request.
    Permission Denied!!!
    api.purlhub.com/JSAPI/purlTrackingApi.min.js?vz=1510:4
    purlTracker DOM setup complete.

    BUT if I then delete the purlcode from the url then the information is successfully extracted from the cookie even though the code isn't in the url.

    So I figured there might be something wrong with my ACL rule?
    http://severnworks.co.uk/wp/personali...*

    Changing the url to personalised-urls-purls/?purl=P955cm8q6v/ works fine still. Would there be a way to make a rewrite rule that redirects to that query ( page-name/?purlcode=purlcode/ ) rather than the page-name/purlcode/ one?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • Joel Bair (purlHub Specialist) February 13, 2015 16:21
    Rebecca,

    You are correct the problem stems form the ACL rule. But its compounded by how the purlCode is extracted from the URL by purlHub.

    You'll need to adjust your "Permalink Settings" in WP to fix this issue.
    Choose "Custom Structure" and ensure the value ends with "/%postname%" - no trailing slash. In your case it may be "/wp/%postname%" - bit is should be already set by WP, you'll just need to check the box on the left tpo select custom and remove the trailing / from the value.

    Due to your permalink settings - Wordpress redirects URLs like /wp/personalised-urls-purls/P955cm8q6v to /wp/personalised-urls-purls/P955cm8q6v/ - adding the trailing slash.

    This redirected URL tricks our purlCode extraction routine and we fallback on Cookie extraction. By default, purlHub looks for purlCodes firstly, at the filename component of the path, Secondly in the QueryString parameter _purl=, and finally in the browser's Cookies. If the URL ends in a /, purlHub assumes this is a directory URL and skips path extraction.

    FYI: Cookie extraction, is a mechanism purlHub uses to always remember a visitor even if they come back to your site with out the purl code. It relies the visitor initially visiting WITH a purlCode at least once, however.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • I’m Relieved
    Ahha that did the trick!

    Thank you for a clear explanation and patience, I have learned a lot from this, near novice that I am.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned