MyBB Community Forums

Full Version: Need Help with Htaccess
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi Guys,
So, I have a problem.. I have a custom .htaccess which rules I have set so that every request on any url on my website goes to a under construction page which is in html. Here is the bit of code for it:

# Redirect Under Construction
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !^xxx\.xxx\.xxx\.xxx$
RewriteCond %{REQUEST_URI} !(maintenance\.html|\.gif|\.jpg|\.png|\.css|\.js|\.eot|\.svg|\.ttf|\.|\.woff|\.otf\.ico)$ [NC]
RewriteRule ^(.*)$ /maintenance.html [R=302,L]

It's working and I'm the only one who can access the site while I'm making it. Now, the problem is.. I want to implement MyBB's SEF urls which needs to add the code from htaccess.txt to my current .htaccess, I am not sure how I would add it without breaking the rewrite rule to my maintenance page, do I just add it to the last ReWriteRule line? In between? I am unsure since I have 'RewriteBase' which MyBB's SEF urls don't have.

Thanks
which type rewriterule u need to add
(09-05-2015, 01:26 PM)adwap7 Wrote: [ -> ]which type rewriterule u need to add

Here's MyBB SEF htaccess rule that I need to add:

<IfModule mod_rewrite.c>
	RewriteEngine on
	RewriteRule ^forum-([0-9]+)\.html$ forumdisplay.php?fid=$1 [L,QSA]
	RewriteRule ^forum-([0-9]+)-page-([0-9]+)\.html$ forumdisplay.php?fid=$1&page=$2 [L,QSA]

	RewriteRule ^thread-([0-9]+)\.html$ showthread.php?tid=$1 [L,QSA]
	RewriteRule ^thread-([0-9]+)-page-([0-9]+)\.html$ showthread.php?tid=$1&page=$2 [L,QSA]
	RewriteRule ^thread-([0-9]+)-lastpost\.html$ showthread.php?tid=$1&action=lastpost [L,QSA]
	RewriteRule ^thread-([0-9]+)-nextnewest\.html$ showthread.php?tid=$1&action=nextnewest [L,QSA]
	RewriteRule ^thread-([0-9]+)-nextoldest\.html$ showthread.php?tid=$1&action=nextoldest [L,QSA]
	RewriteRule ^thread-([0-9]+)-newpost\.html$ showthread.php?tid=$1&action=newpost [L,QSA]
	RewriteRule ^thread-([0-9]+)-post-([0-9]+)\.html$ showthread.php?tid=$1&pid=$2 [L,QSA]

	RewriteRule ^post-([0-9]+)\.html$ showthread.php?pid=$1 [L,QSA]

	RewriteRule ^announcement-([0-9]+)\.html$ announcements.php?aid=$1 [L,QSA]

	RewriteRule ^user-([0-9]+)\.html$ member.php?action=profile&uid=$1 [L,QSA]

	RewriteRule ^calendar-([0-9]+)\.html$ calendar.php?calendar=$1 [L,QSA]
	RewriteRule ^calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)\.html$ calendar.php?calendar=$1&year=$2&month=$3 [L,QSA]
	RewriteRule ^calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)-day-([0-9]+)\.html$ calendar.php?action=dayview&calendar=$1&year=$2&month=$3&day=$4 [L,QSA]
	RewriteRule ^calendar-([0-9]+)-week-(n?[0-9]+)\.html$ calendar.php?action=weekview&calendar=$1&week=$2 [L,QSA]

	RewriteRule ^event-([0-9]+)\.html$ calendar.php?action=event&eid=$1 [L,QSA]

	<IfModule mod_env.c>
		SetEnv SEO_SUPPORT 1
	</IfModule>
</IfModule>
(09-05-2015, 01:34 PM)adwap7 Wrote: [ -> ]go here for full TUT  http://community.mybb.com/thread-99435.html

Sorry, but no. Neither of the discussions there are applicable to my problem.
You can add it before or after your code - the RewriteBase sholdn't make a difference if your MyBB installation is located in the domain's main directory. If something goes wrong, you can just remove it Wink
(09-05-2015, 01:57 PM)Devilshakerz Wrote: [ -> ]You can add it before or after your code - the RewriteBase sholdn't make a difference if your MyBB installation is located in the domain's main directory. If something goes wrong, you can just remove it Wink

Hi d.shakerz,
Just to confirm, before/after the whole code that I mentioned that I currently have or after the Rewriterules and before it? If it's the first, wouldn't there be any conflict if there are more than 1 rewrite engines?
(09-05-2015, 02:06 PM)liisyaoron Wrote: [ -> ]Just to confirm, before/after the whole code that I mentioned that I currently have or after the Rewriterules and before it?
The whole block you posted.

Quote:wouldn't there be any conflict if there are more than 1 rewrite engines?
They both enable this feature - one of these declarations can be removed but nothing bad will happen if you keep it as it is.
(09-05-2015, 02:10 PM)Devilshakerz Wrote: [ -> ]
(09-05-2015, 02:06 PM)liisyaoron Wrote: [ -> ]Just to confirm, before/after the whole code that I mentioned that I currently have or after the Rewriterules and before it?
The whole block you posted.

Quote:wouldn't there be any conflict if there are more than 1 rewrite engines?
They both enable this feature - one of these declarations can be removed but nothing bad will happen if you keep it as it is.

Took a gander and just combined MyBB's Rewrite code into my currently Redirect code and everything looks ok even in the archive. Cheers