• ❌ Yo could do a bash oneliner with the docker run, the docker exec a2enmod, and commit (not best practice IMHO) • ❌ Yo could have those bash steps encapsulated in a bash function to reuse, with or without the commit (not best practice IMHO) • ✅ Or you could write ONCE the Dockerfile, then commit with '-t myphp:5.6-apache-rewrite' and have a new image the Docker way, with it's beautiful cached layers and reach the Docker ?Heaven ?! Then you can delete the Dockerfile and never again write one. ?file is your friend, don't be mean to it, it's just innocent ASCII. I also rejected the idea at first, and sincerely laughed at it, but you'll end up adding some more apache mods or libraries (imagemagick, etc) and having that Dockerfile will be useful for upgrading your base apache container. I recommend you putting that base apache in a public repo, it could be useful for someone or just as 'personal marketing' to show up you are using Docker and creating your own containers.
![Activate Mod_rewrite Xampp Activate Mod_rewrite Xampp](https://1.bp.blogspot.com/-QvpKlEw1x_c/UyDrqSzFgpI/AAAAAAAABKE/36l1H6oBdzY/s1600/1.png)
Bear in mind that this could be a first step into a 'continuous integration' or 'continuous delivery' workflow, where you have multiple containers you'd like to test and deploy together (just for fun, just for the coolness of that, or just for the 'personal marketing'). In my workplace the codebase it's getting more complex everyday so any automation is welcome. If your are interested in using the container with the volume of your actual folder, probably the script way is better, because in the end even with Dockerfile you'll have to write that long bash line to run the container with the port, volume, name, etc. Even if u use docker-compose, where you can define the port and the volume, you'll have to hack a bit to get the right path used, because it uses absolute path's, relative to home folder, or relative to docker-compose.yml, so if you want your actual folder to be used you'll have to use and set environmental or bash variables, and again you'll end up writing messy bash or doing again some bash alias/function.
So I retract in my previous opinion about the Dockerfile, but I suggest using some form of bash alias/function to encapsulate it • As I said before, here is a Gist with an implementation of that idea •.
This module uses a rule-based rewriting engine (based on a regular-expression parser) to rewrite requested URLs on the fly. It supports an unlimited number of rules. If you have installed Apache HTTP server via apt-get or aptitude on Debian or Ubuntu systems, it has mod_rewrite module installed, but not enabled by default. Follow these steps to enable the mod_rewrite Apache rewrite module on SuSE Linux.
The article below describes how to adjust the Apache webserver properties to ensure proper functionality. You can adjust the Apache webserver properties to your needs by editing a control file. You can list various commands in this file enabling you to control access to a directory, to have custom error pages, to list the content of directories, etc.
If you have installed Apache HTTP server via apt-get or aptitude on Debian or Ubuntu systems, it has mod_rewrite module installed, but not enabled by default. How to Enable mod_rewrite in Apache Server. If you are trying to make your urls ready for search engines, this tutorial will show you how to make them using apache.
The control file '.htaccess' can be placed in various directories of your site. Please note that commands in a.htaccess file affect ALL subdirectories as well! Whenever using mod_rewrite and/or the rewrite engine, it MAY not function properly on standard shared hosting and/or managed servers without the following line added before it in the.htaccess file.
![Activate Mod Rewrite Activate Mod Rewrite](http://2.bp.blogspot.com/-aEYiA2f3mtY/VV7JwKL4c6I/AAAAAAAACOQ/Lv55SRaCrpA/s1600/Mod_rewrite%2B03b.jpg)