XF 2.2 Page not found after move xf on forum directory

forumSolution

Active member
Hello,

i move my xf from root directory to /forum xf working fine but my old url when i access them i am getting error page not found

my wp htacess file is

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>


what i should change on above code or old urls ?

Thanks
 
Yes i have write above on my xf's htaccess file now my xf working fine but problem is

For example my old url was

Abc.com

Now it is abc.com/forum

So if access my threads with old url for example

Abc.com/threads/test.1/

It giving me error something i need to change my wp's htaccess file

Can you please guide me
 
my htaccess code for xf

Code:
#    Mod_security can interfere with uploading of content such as attachments. If you
#    cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#    SecFilterEngine Off
#    SecFilterScanPOST Off
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 405 default
ErrorDocument 406 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 503 default

<IfModule mod_rewrite.c>

    #    If you are having problems with the rewrite rules, remove the "#" from the
    #    line that begins "RewriteBase" below. You will also have to change the path
    #    of the rewrite to reflect the path to your XenForo installation.
    RewriteEngine on
RewriteCond %{REQUEST_URI} ^/$
RewriteRule (.*) /forum/ [R=301]


    #    This line may be needed to workaround HTTP Basic auth issues when using PHP as a CGI.
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
</IfModule>
 
here is my htaccess for wp

Code:
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#RewriteBase /

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

RewriteRule ^threads/(.*)$ forum/threads/$1[R=301,L]
RewriteRule ^forums/(.*)$ forum/forums/$1[R=301,L]
RewriteRule ^tags/(.*)$ forum/tags/$1[R=301,L]


 




</IfModule>

# END WordPress


here is a line
Code:
RewriteRule . /index.php [L]
if remove it then old url work but then wp post url not work

someone please guide me ??
 
Last edited:
The problem may be that if you redirect everything form the root to a subdirectory, then it is redirecting the wp index.php also so this is probably a big problem as it xf also has index .php.
I just want keep my old xf url as well new url .. after moving xf on sub folder
 
Yes i have write above on my xf's htaccess file now my xf working fine but problem is

For example my old url was

Abc.com

Now it is abc.com/forum

So if access my threads with old url for example

Abc.com/threads/test.1/

It giving me error something i need to change my wp's htaccess file

Can you please guide me
@Mr Lucky here is my scenario
 
As you now have WP in the root, you can't do a catch all rewrite otherwise WP wouldn't load.
You will need to add a rule for each route in XF, something like:

Code:
rewrite ^/threads/(.*)$ forum/threads/$1 permanent [R=301,L]
rewrite ^/posts/(.*)$ forum/posts/$1 permanent [R=301,L]
rewrite ^/members/(.*)$ forum/members/$1 permanent [R=301,L]

And so on.

Assuming those routes don't also exist in WP.
 
Top Bottom