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


This partial url:


gives a 302 redirect to this full url:


This is done from core Q2A.

I would like to make those redirects to be 301, instead of 302.

What file/code should I change please?

Q2A version: 1.8

2 Answers

0 votes
Same here:


I am wondering, since the page has the correct canonical tag "learn-greek-online.com/ask-greek/302/fere-mou-to", why does google index both pages?
301 redirect is a permanent redirect where 302 is partial redirect. You can check detailed information about it at https://moz.com/learn/seo/redirection
priyasengp45, I know all these.  

My question remains: How can I convert the 302 to 301 redirects?
You have to make changes in your htaccess code.

For example,
I have a website with the following .htaccess file:

AddType application/x-httpd-php5 .php
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

##RewriteBase /~site/
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php
#php values
#php_value register_globals 0
<IfModule mod_dir.c>
    DirectoryIndex index.php index.htm index.html index.shtml index.cgi
<FilesMatch "^\.ht">
Order allow,deny
Deny from all

You can simply change 302 to 301.

Hopefully, it will help you
But in your code you do not have a 302.  How can I change it to 301?
I mean made change where 301 is mentioned.
You must be having 302 there, you need to change that to 301.
This is my htaccess file.  There is no 302 to change.  

Options -Indexes
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /

# remove the www
RewriteCond %{HTTP_HOST} ^(www\.learn-greek-online\.com)?$
RewriteRule ^(.*)$ https://learn-greek-online.com/ask-greek/$1 [R=301,L]

RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]

I don't think what you propose is a viable solution.
0 votes

Hello @bobptz,

This can be done by adding this line of code:

header("HTTP/1.1 301 Moved Permanently");

here: qa-include/pages/question.php

This answer describes how to do it in Question2Answer 1.8.5:

I hope it is useful.
Have a nice day!