CUTCODEDOWN
Minimalist Semantic Markup

Welcome Guest
Please Login or Register

If you have registered but not recieved your activation e-mail in a reasonable amount of time, or have issues with using the registration form, please use our Contact Form for assistance. Include both your username and the e-mail you tried to register with.

Author Topic: Getting it working on other servers than Apache  (Read 789 times)

Jason Knight

  • Administrator
  • Hero Member
  • *****
  • Posts: 844
  • Karma: +159/-1
    • CutCodeDown -- Minimalist Semantic Markup
Getting it working on other servers than Apache
« on: 6 Dec 2020, 02:48:20 pm »
It's something I want implemented, but other than ngnix my experience is limited in the "modern" world.

I'm adding this .txt file to the system.

Quote
To function paladin/squire requires a rewriterule for "friendly uri's" and the "one index to rule them all" approach to development.

The following:

*** Apache (original, tested) ***

RewriteEngine On
RewriteRule !(\.(gif|jpg|png|css|js|html|txt|ico|zip|rar|pdf|xml|mp3|mp4|mpg|flv|swf|mkv|ogg|avi|woff|woff2|svg|eot|ttf|json|webmanifest)$) index.php


Should be added on Apache systems in your hosts file or via .htaccess


The following are rough equivalents for other server software. These are untested and would require someone more versed in these systems han I am to test and apply them.

-----------------------------------------------

*** Lighttpd (untested) ***

# change server.document.root to match your actual install location
server.document.root = "/var/www/domain/web"
url.rewrite-once = {
   "(\.(gif|jpg|png|css|js|html|txt|ico|zip|rar|pdf|xml|mp3|mp4|mpg|flv|swf|mkv|ogg|avi|woff|woff2|svg|eot|ttf|json|webmanifest)$)" = "/index.php"
   
}

-----------------------------------------------

*** ngnix (untested) ***

location / {
  rewrite !(\.(gif|jpg|png|css|js|html|txt|ico|zip|rar|pdf|xml|mp3|mp4|mpg|flv|swf|mkv|ogg|avi|woff|woff2|svg|eot|ttf|json|webmanifest)$) /index.php;
}

-----------------------------------------------

*** Microsoft IIS (untested, likely needs more XML structure!) ***
<rewrite>
   <rules>
      <rule name="Redirect non-whitelisted to index.php">
         <match url="(\.(gif|jpg|png|css|js|html|txt|ico|zip|rar|pdf|xml|mp3|mp4|mpg|flv|swf|mkv|ogg|avi|woff|woff2|svg|eot|ttf|json|webmanifest)$)"  />
         <action type="Rewrite" url="/index.php"  />
      </rule>
   </rules>
</rewrite>

-----------------------------------------------

*** PHP (unwritten) ***

PHP has its own server for testing purposes ONLY, that I think can do this using a front controller, but I've got no clue where to start.


-----------------------------------------------

If anyone has any ideas on how to take this further or is willing to step up and test it, please visit the general discussion area of our forums.

https://forums.cutcodedown.com/index.php?board=28.0


As it says, if anyone is willing to test or help me get these written, it would be greatly appreciated. NOT that we should probably waste time with the PHP local server method given that should never be used on a deployment site... but it IS a possibility some people might use for dev.
I'll fix every flaw, I'll break every law, I'll tear up the rulebook if that's what it takes. You will see, I will crush this cold machine.

 

SMF spam blocked by CleanTalk

Advertisement