Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+6 votes
503 views
in Q2A Core by
edited by

Hello

If the user has a space in his username (like for example "John 123") there is problem with entering his user's site because of the space in the link. It links me to address domain.com/user/John 123 (and causes error 403) instead of domain.com/user/John+123. What is more, when I manually type domain.com/user/John+123 it says: Page not found! Which means the user profile site is completely inaccessible.

I think the issue may be generated by version 1.8.8, because I didn't have such a problem anytime before. Now it appeared and I don't know exactly when, but most probably a few days ago, after updating Q2A to latest version.

What is wrong and how can I fix that?

EDIT: I just confirmed that issue is generated only in v. 1.8.8. I set up test Q2A site using the same database, but in v. 1.8.6 and this problem doesn't exist there.

Q2A version: 1.8.8
by
Can you share with me the .htaccess file, just in case?

Also, is the issue fixed if you change this line:

    RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]

With this line:

    RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [B,L]

Or maybe better, this one:

    RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [BCTLS,L]

Finally, what version of Apache are you using exactly?
by
edited by
Ok, I replaced the line you mentioned and now it's working. The script still generates links with spaces included (is that ok?), but they now lead to proper profile pages instead of error 403.

Below there is my full .htaccess file after this last change, with only website address replaced by a phrase "(website-address)".

Options -Indexes
DirectoryIndex index.php
AddType application/x-httpd-php81 .php
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ (website-address)/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [BCTLS,L]
</IfModule>
by
I had this same issue with version 1.8.8.
by
because of this my site getting error in google console, most of profile url changed with  + to blank unicode

1 Answer

+4 votes
by
selected by
 
Best answer

In your htaccess you need to add a B flag to the last line, like this:

RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [B,L]

It’s due to some changes with the urlencode function. For some reason this didn’t get updated in the htaccess-example on the bugfix branch, only the dev branch.

by
because of this my site getting error in google console, most of profile url changed with  + to blank unicode, so we downgrade my q2a cms to 1.8.6.
...