close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

php in htaccess

Thread began 10/06/2017 12:59 am by Jamie | Last modified 10/10/2017 10:44 am by Ray Borduin | 2060 views | 5 replies |

Jamie

php in htaccess

Hey Ray

Just wondering how, if possible at all, you could use php within an htaccess file?

Basically, am looking to give clients the ability to turn on/off the website to do maintenance so would just have it check if a column was set to 0 or 1 so that this could be shown/hidden and then also check an ip address that they would enter (shown as ??? beloiw):

RewriteCond %{REMOTE_ADDR} !^8\.8\.8\.8
RewriteCond %{REMOTE_ADDR} !^???\.???\.???\.???
RewriteCond %{REQUEST_URI} !^/maintenance/$
RewriteRule ^(.*)$ http://domain.co.uk/maintenance/index.php [R=307,L]

cheers

Jamie

Sign in to reply to this post

Ray BorduinWebAssist

I think you would have to do it in the php directly and not the .htaccess.

The way I've done this in the past is to add a check on the theme page (using webassist themes) that redirects to the maintenance section if it is in maintenance mode, but allows admins to continue browsing the site to debug.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

would that be using security assist and setting a permission for maintenance ?

Sign in to reply to this post

Ray BorduinWebAssist

I think just adding a recordset to check if it is maintenance mode and then redirecting to the maintenance page would be enough. Don't really need security assist, but I suppose you could set a session variable from the value and do more complex rules with security assist if it was necessary, like letting through admin.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

sorry Ray, being a bit thick here.

How would the page 'know' to redirect a visitor to the maintenance page but allow admins to keep being able to browse the site?

Sign in to reply to this post

Ray BorduinWebAssist

You would write an IF statement that checked to see if they were admin and skip the redirect if they were.

Sign in to reply to this post
Did this help? Tips are appreciated...

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...