I’ve a problem with my .htaccess
file.
I recently moved the forum (IPB) that was in the root path in a subdirectory, so I wrote this .htaccess
file
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule ^view/([0-9]+)/?$ index.php?view=$1 [NC,L]
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
RewriteCond %{REQUEST_URI} !^/forum/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /forum/$1
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
RewriteRule ^(/)?$ forum/index.php
And this worked very well.
Basically, I wanted that old urls that were pointing to forum, were redirected to forum subdir.
But here’s the problem.
In the root path now, there is a index.php that will be the new website, I want SEO friendly urls, so I wrote this line
RewriteRule ^view/([0-9]+)/?$ index.php?view=$1 [NC,L]
But this rule doesn’t work.
Every request like
www.domain.com/view/welcome/
redirect to a 404 page of the IPB forum.
I tried also to put some RewriteCond but the result is the same,
every url involving the new index.php in the root path turns in a 404 Page.
EDIT:
In /forum/
There is this .htaccess
ErrorDocument 401 /401.shtml
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /forum
RewriteCond %{REQUEST_FILENAME} .*.(jpeg|jpg|gif|png)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /public/404.php [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L,QSA]
</IfModule>
2
Answers
I found the problem! I was using this:
To check if the user was logged in the forum, but I haven't wrote this line
That tells to IPB to NOT handle by itself the url that you are going to map (I think that this allow an external access)
So I ended up with the
.htaccess
from @splash58 (thank you!)In the Rule below you match only digits after view but want
welcome
change to
and add some lines to void unnecessary redirects