Rewrite rule

Ozzy47

Well-known member
I need help with a rewrite rule. A community moved from https://forumpromotion.net/forum to https://community.forumpromotion.net/ so I need a redirect for any links that are posted on the site. Note that there is a valid home page now at https://forumpromotion.net/ so that can not be affected by the rule.
 
Not my strong point but try this: RewriteRule ^/forum/(.*)$ https://community.forumpromotion.net/$1 [R=301,L]
 
Is it an Apache webserver?
Is mod_rewrite enabled?
Did you place that line in the domain root .htaccess file?

What are the file contents?
 
If it is an apache server then you need module mod_rewrite and then use this code in .htaccess

(I havent tested it and am a bit rusty on Apache - So it may not work)

Code:
# Rewrite Rule.  https://forumpromotion.net/forum/ >>> https://community/forumpromotion.net/

RewriteCond %{HTTP_HOST} ^forumpromotion\.net$
RewriteRule ^forum$ https://community.forumpromotion.net/?&%{QUERY_STRING}

The above code needs to be below the RewriteEngine On condition in .htaccess

You'll probably also need to hard refresh your browser
 
Last edited:
You'll probably also need to hard refresh your browser
This ^^

Browser caching really gets in the way sometimes, so I just have it permanently switched off on all my browsers so I know I'm always seeing the latest version of a page and following the right redirects.
 
If in the forum directory:

RewriteRule ^/?(.*)$ https://mydomainname.com/community/$1 [R=301,L]

I have a similar problem. This rewrite rule in the forum directory works for me in general. It forwards to my new domain with the correct subfolder.

BUT my situation is a little bit more complicated. I merged 2 XF forums. The old forum was imported into the new (but already existing) forum.

Therefore the numbers for subforums and threads are in the new forum differently than in the old forum. Except for 2 subforums, which did not exist in the new forum at all. The old links are redirected correctly for these 2 subforums into the right spot within the new forum.

But the the URLs for the other subforums get the error:

Oops! We ran into some problems.​

The requested thread could not be found.


I have in the DB this archived_import table information, but I do not know how to write the code so that it switches from the old forums numbers to the new forums numbers for those subforums correctly.

Can anybody help me with this?
 
Last edited:
Back
Top Bottom