(Not so) pretty URLs
Permalink
I have been using concrete5 for my site for a few years now, and have never been able to get pretty URLs to function properly . . . wondering if someone could lend some help.
The only way I can get URL rewriting to work is if I include the [R] flag on my rewrite rule, which of course causes a full redirect and pretty much defeats the purpose of pretty URLSs. Here's my .htaccess at the root directory:
My host is TextDrive, by the way.
If I remove the R flag on the index.php RewriteRule, I get the lovely "No input file specified" message. A few different times I have attempted to fix this, but server configuration and PHP internals is definitely not my cup of tea. Here, you can look at my phpinfo if you like:http://www.themiracleschool.net/testing/test.php...
I understand the error has to do with PHP not getting the "input file" from the server, but I don't know what makes it happen for me when others seem to not have this problem. I've read quite a few threads here and googled, etc., but no luck for me.
I'm at the point, however, where I need to get this working. Particularly, I need to make sure that the query string and hash parts of the url do not get lost as they currently do in the redirect, which is quite annoying.
Any help appreciated.
The only way I can get URL rewriting to work is if I include the [R] flag on my rewrite rule, which of course causes a full redirect and pretty much defeats the purpose of pretty URLSs. Here's my .htaccess at the root directory:
#Options +FollowSymLinks is already on Options -MultiViews RewriteEngine On RewriteBase / BrowserMatch chromeframe gcf Header append X-UA-Compatible "chrome=1" env=gcf #Header append X-UA-Compatible "IE=Edge" AddType text/x-component .htc RewriteCond %{HTTP_HOST} ^affiliate\. [NC] RewriteRule ([a-zA-Z0-9\._-]+) /affiliate/$1 [L] RewriteRule ^affiliate - [L] RewriteCond %{REQUEST_URI} !^index\.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !/dav
Viewing 15 lines of 18 lines. View entire code block.
My host is TextDrive, by the way.
If I remove the R flag on the index.php RewriteRule, I get the lovely "No input file specified" message. A few different times I have attempted to fix this, but server configuration and PHP internals is definitely not my cup of tea. Here, you can look at my phpinfo if you like:http://www.themiracleschool.net/testing/test.php...
I understand the error has to do with PHP not getting the "input file" from the server, but I don't know what makes it happen for me when others seem to not have this problem. I've read quite a few threads here and googled, etc., but no luck for me.
I'm at the point, however, where I need to get this working. Particularly, I need to make sure that the query string and hash parts of the url do not get lost as they currently do in the redirect, which is quite annoying.
Any help appreciated.
You're right, the site was still on 5.5.1. I updated to 5.5.2.1 and that solved part of the problem. I now have URL rewriting working without a redirect using the magic of c5's internal interpretation, I suppose. So, no more "index.php" visible in the URL.
But still, c5 is taking any "alias" path and changing it to the canonical URL, and in the process is losing the query string and hash. So, for instance, if I have a page whose canonical URL is /forms/agreement and I add the alias /agreement in its Page Properties, then if I were to try to access the page via /agreement?option=true, in the browser it becomes just /forms/agreement without the query string.
In my circumstance, I do need to be able to use the alias and have it pass the query string and hash to the page. It seems like it should do this anyway, otherwise having an alias is like a faux ami.
Perhaps this is resolved in version 5.6, but I can't upgrade until I resolve another issue (http://www.concrete5.org/community/forums/installation/error-upgrad... ).
Meanwhile, any suggestions would be very helpful.
Thank you for your help, Remo.
But still, c5 is taking any "alias" path and changing it to the canonical URL, and in the process is losing the query string and hash. So, for instance, if I have a page whose canonical URL is /forms/agreement and I add the alias /agreement in its Page Properties, then if I were to try to access the page via /agreement?option=true, in the browser it becomes just /forms/agreement without the query string.
In my circumstance, I do need to be able to use the alias and have it pass the query string and hash to the page. It seems like it should do this anyway, otherwise having an alias is like a faux ami.
Perhaps this is resolved in version 5.6, but I can't upgrade until I resolve another issue (http://www.concrete5.org/community/forums/installation/error-upgrad... ).
Meanwhile, any suggestions would be very helpful.
Thank you for your help, Remo.
Well, I think that's another problem and no, it looks like it still happens with 5.6.1.2!
I never had that problem before, but I completely agree, if concrete5 redirects to another page it shouldn't remove the GET parameters. Are you doing the same with POST requests? That might be a bit trickier to fix because of the them when the POST parameters have to be processed. We can't send a browser redirect and process POST parameters afterwards, we'd basically have to process the POST parameters before redirecting to the canonical URL....
I never had that problem before, but I completely agree, if concrete5 redirects to another page it shouldn't remove the GET parameters. Are you doing the same with POST requests? That might be a bit trickier to fix because of the them when the POST parameters have to be processed. We can't send a browser redirect and process POST parameters afterwards, we'd basically have to process the POST parameters before redirecting to the canonical URL....
That's a good point, but I've never tried with POST parameters because I always code my forms and ajax requests using c5's methods like $this->url('/request', 'submit') or $this->action('subscribe'). Since single pages are at the root of the sitemap anyway and external form blocks have the 'action' method, the issue has never come up for me.
Too bad 5.6.1.2 behaves the same.
Too bad 5.6.1.2 behaves the same.
I had a quick look at this, fixing it the right way (GET+POST..) looks like a big thing. Nothing I can do within the next few days.
You might want to open a ticket in the bugtacker!
You might want to open a ticket in the bugtacker!
I've posted a bug athttp://www.concrete5.org/index.php?cID=472663....
I've also upgraded to 5.6.1.2 and tested with POST vars as well and can confirm that they get lost in alias-to-canonical redirection just like GET vars and hashes.
Thank you for your clarity and generous support.
I've also upgraded to 5.6.1.2 and tested with POST vars as well and can confirm that they get lost in alias-to-canonical redirection just like GET vars and hashes.
Thank you for your clarity and generous support.
In order to be able to work with this htaccess file you need to work with an up to date concrete5 version though!
Can you try this and post your result in this discussion?