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

I've got an existing website, that's been up for over 10 years, and it has 1000's of pages. Can I swap out my current index.php and still have the rest of my site run correctly?

I'd like to run this as the main index page, not as a subdirectory, but I'm worried about trying to implement the .htaccess in this format: /123/why-do-birds-sing (requires htaccess file)

DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
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]
</IfModule>
 

If I do this, will the .htaccess file try to rewrite my old urls?

Q2A version: 1.5.1

1 Answer

0 votes
by
edited by

This is almost certainly going to lead to conflicts somewhere. The htaccess rule basically says: "Take every request that isn't a specific file or directory, and pass the request to index.php".

You will still need your Q2A index.php but it may be possible to rename it to for example qa.php, as long as you change index.php to qa.php in the htaccess.

If the thousands of pages you already have are actual files in the filesystem (e.g. page.html or page.php) then it should work OK, but if you're already using rewrites it probably won't work.

Overall, your best bet is to put Q2A in a subfolder.

...