I am completely new to docker. Just trying to run WordPress within a docker instance to learn more about it.
./public_html/ - has WordPress files and from the domain, I am able to access the installer. However the WordPress installer cant update wp-config.php within docker - as below error.
Unable to write to wp-config.php file.
version: '3'
services:
web:
image: webdevops/php-apache:7.2
container_name: web
restart: always
environment:
- PHP_DISPLAY_ERRORS=1
- PHP_MEMORY_LIMIT=2048M
- PHP_MAX_EXECUTION_TIME=300
- PHP_POST_MAX_SIZE=500M
- PHP_UPLOAD_MAX_FILESIZE=256M
volumes:
- ./public_html/:/app
ports:
- "80:80"
- "443:443"
links:
- mysql
mysql:
image: mariadb:10
container_name: mysql
restart: always
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=test
volumes:
- db-data:/var/lib/mysql
phpmyadmin:
container_name: phpmyadmin
restart: always
image: phpmyadmin/phpmyadmin:latest
# environment:
# - MYSQL_ROOT_PASSWORD=root
# - PMA_USER=root
# - PMA_PASSWORD=root
ports:
- "8080:80"
links:
- mysql:db
depends_on:
- mysql
volumes:
db-data:
external: false
Now WordPress allow me to create the config.php. installation went on. I just tried to upload a plugin to test and I get below error. which I anticipated.
Unable to create directory wp-content/uploads/2021/02. Is its parent
directory writable by the server?
I logged into the docker "docker exec -it 51af15ed3678 bash" to check file permission.
root#51af15ed3678:/# ls -lart
total 104
drwxr-xr-x 2 root root 4096 Nov 22 12:37 boot
drwxr-xr-x 2 root root 4096 Dec 9 23:22 srv
drwxr-xr-x 2 root root 4096 Dec 9 23:22 mnt
drwxr-xr-x 2 root root 4096 Dec 9 23:22 media
drwxr-xr-x 2 root root 4096 Dec 9 23:22 lib64
drwx------ 2 root root 4096 Feb 27 22:12 entrypoint.d
lrwxrwxrwx 1 root root 28 Feb 27 22:12 entrypoint.cmd -> /opt/docker/bin/entrypoint.d
lrwxrwxrwx 1 root root 29 Feb 27 22:12 entrypoint -> /opt/docker/bin/entrypoint.sh
drwxr-xr-x 1 root root 4096 Feb 27 22:12 home
drwx------ 1 root root 4096 Feb 27 22:31 root
drwxr-xr-x 1 root root 4096 Feb 27 22:36 sbin
drwxr-xr-x 1 root root 4096 Feb 27 22:36 lib
drwxr-xr-x 1 root root 4096 Feb 27 22:36 bin
drwxr-xr-x 1 root root 4096 Feb 27 22:36 var
drwxr-xr-x 1 root root 4096 Feb 27 22:36 usr
drwxr-xr-x 1 root root 4096 Feb 27 22:36 opt
drwxr-xr-x 1 root root 4096 Feb 28 13:36 etc
-rwxr-xr-x 1 root root 0 Feb 28 13:36 .dockerenv
dr-xr-xr-x 197 root root 0 Feb 28 13:36 proc
dr-xr-xr-x 13 root root 0 Feb 28 13:36 sys
lrwxrwxrwx 1 root root 12 Feb 28 13:36 docker.stdout -> /proc/1/fd/1
lrwxrwxrwx 1 root root 12 Feb 28 13:36 docker.stderr -> /proc/1/fd/2
srwx------ 1 root root 0 Feb 28 13:36 .supervisor.sock
drwxr-xr-x 5 root root 360 Feb 28 13:36 dev
drwxr-xr-x 1 root root 4096 Feb 28 13:36 run
drwxr-xr-x 5 root root 4096 Feb 28 17:24 app
drwxr-xr-x 1 root root 4096 Feb 28 17:28 ..
drwxr-xr-x 1 root root 4096 Feb 28 17:28 .
root#51af15ed3678:/# cd app
root#51af15ed3678:/app# ls -lart
total 32876
-rwxr-xr-x 1 root root 3300 Feb 6 2020 wp-load.php
-rwxr-xr-x 1 root root 2496 Feb 6 2020 wp-links-opml.php
-rwxr-xr-x 1 root root 2913 Feb 6 2020 wp-config-sample.php
-rwxr-xr-x 1 root root 351 Feb 6 2020 wp-blog-header.php
-rwxr-xr-x 1 root root 405 Feb 6 2020 index.php
-rwxr-xr-x 1 root root 19915 Feb 12 2020 license.txt
-rwxr-xr-x 1 root root 8509 Apr 14 2020 wp-mail.php
-rwxr-xr-x 1 root root 3236 Jun 8 2020 xmlrpc.php
-rwxr-xr-x 1 root root 7278 Jun 26 2020 readme.html
-rwxr-xr-x 1 root root 7101 Jul 28 2020 wp-activate.php
-rwxr-xr-x 1 root root 3939 Jul 30 2020 wp-cron.php
-rwxr-xr-x 1 root root 31337 Sep 30 21:54 wp-signup.php
-rwxr-xr-x 1 root root 4747 Oct 8 21:15 wp-trackback.php
-rwxr-xr-x 1 root root 2328 Oct 8 21:15 wp-comments-post.php
-rwxr-xr-x 1 root root 49831 Nov 9 10:53 wp-login.php
-rwxr-xr-x 1 root root 20975 Nov 12 14:43 wp-settings.php
drwxr-xr-x 25 root root 12288 Feb 22 15:10 wp-includes
drwxr-xr-x 4 root root 4096 Feb 22 15:10 wp-content
drwxr-xr-x 9 root root 4096 Feb 22 15:10 wp-admin
-rwxr-xr-x 1 root root 16712083 Feb 22 15:10 latest.zip.1
-rwxr-xr-x 1 root root 16712083 Feb 22 15:10 latest.zip
-rw-r--r-- 1 root root 3181 Feb 28 17:24 wp-config.php
drwxr-xr-x 5 root root 4096 Feb 28 17:24 .
drwxr-xr-x 1 root root 4096 Feb 28 17:28 ..
root#51af15ed3678:/app#
Any clue will be a great help. Thank you.
Regards,
Dwija
The image is running the daemon under user application (UID 1000; GID 1000) so make sure all files are owned by the user application not root
Related
I've read a few questions about the same problem but i couldn't find any answer that works. I have a "mkdir permission denied" problem in PHP. I've tryed to change a few directories and users permissions, but it still doesn't work.
So, the erro is: "Warning: mkdir(): Permission denied in /www/denunciar/private/utilits.php on line 52"
This is my Docker-compose yml file:
services:
webserver:
image: nginx:stable
container_name: nginx
restart: always
ports:
- 80:80
volumes:
- ./www:/www
- ./site.conf:/etc/nginx/conf.d/site.conf
links:
- php
php:
image: php:8-fpm
container_name: php-fpm
volumes:
- ./www:/www
links:
- mysql-db-gestaofisc
mysql-db-gestaofisc:
image: mysql:5.7
container_name: mysql
ports:
- "3306:3306"
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: *****
MYSQL_DATABASE: dbname
MYSQL_USER: uname
MYSQL_PASSWORD: *****
links:
- phpmyadmin
phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- "8084:80"
restart: always
environment:
PMA_HOST: mysql-db-gestaofisc
In the Nginx container, i set root group and root user as www directory's owner and nginx user in root group:
# pwd
/
# ls -la
total 88
drwxr-xr-x 1 root root 4096 Aug 9 19:10 .
drwxr-xr-x 1 root root 4096 Aug 9 19:10 ..
-rwxr-xr-x 1 root root 0 Aug 9 19:10 .dockerenv
drwxr-xr-x 2 root root 4096 Aug 1 00:00 bin
drwxr-xr-x 2 root root 4096 Jun 30 21:35 boot
drwxr-xr-x 5 root root 340 Aug 11 16:45 dev
drwxr-xr-x 1 root root 4096 Aug 2 05:18 docker-entrypoint.d
-rwxrwxr-x 1 root root 1202 Aug 2 05:17 docker-entrypoint.sh
drwxr-xr-x 1 root root 4096 Aug 9 19:47 etc
drwxr-xr-x 2 root root 4096 Jun 30 21:35 home
drwxr-xr-x 1 root root 4096 Aug 1 00:00 lib
drwxr-xr-x 2 root root 4096 Aug 1 00:00 lib64
drwxr-xr-x 2 root root 4096 Aug 1 00:00 media
drwxr-xr-x 2 root root 4096 Aug 1 00:00 mnt
drwxr-xr-x 2 root root 4096 Aug 1 00:00 opt
dr-xr-xr-x 357 root root 0 Aug 11 16:45 proc
drwx------ 2 root root 4096 Aug 1 00:00 root
drwxr-xr-x 1 root root 4096 Aug 11 16:45 run
drwxr-xr-x 2 root root 4096 Aug 1 00:00 sbin
drwxr-xr-x 2 root root 4096 Aug 1 00:00 srv
dr-xr-xr-x 11 root root 0 Aug 11 16:45 sys
drwxrwxrwt 1 root root 4096 Aug 2 05:18 tmp
drwxr-xr-x 1 root root 4096 Aug 1 00:00 usr
drwxr-xr-x 1 root root 4096 Aug 1 00:00 var
drwxrwxrwx 1 root root 512 Aug 9 19:27 www
# groups nginx
nginx : nginx root
#
Also, in PHP container i did the same with www directory and www-data user:
# pwd
/
# ls -la
total 80
drwxr-xr-x 1 root root 4096 Aug 9 19:10 .
drwxr-xr-x 1 root root 4096 Aug 9 19:10 ..
-rwxr-xr-x 1 root root 0 Aug 9 19:10 .dockerenv
drwxr-xr-x 1 root root 4096 Aug 2 06:17 bin
drwxr-xr-x 2 root root 4096 Jun 30 21:35 boot
drwxr-xr-x 5 root root 340 Aug 11 16:45 dev
drwxr-xr-x 1 root root 4096 Aug 11 16:42 etc
drwxr-xr-x 2 root root 4096 Jun 30 21:35 home
drwxr-xr-x 1 root root 4096 Aug 2 06:17 lib
drwxr-xr-x 2 root root 4096 Aug 1 00:00 lib64
drwxr-xr-x 2 root root 4096 Aug 1 00:00 media
drwxr-xr-x 2 root root 4096 Aug 1 00:00 mnt
drwxr-xr-x 2 root root 4096 Aug 1 00:00 opt
dr-xr-xr-x 358 root root 0 Aug 11 16:45 proc
drwx------ 1 root root 4096 Aug 4 21:10 root
drwxr-xr-x 3 root root 4096 Aug 1 00:00 run
drwxr-xr-x 2 root root 4096 Aug 1 00:00 sbin
drwxr-xr-x 2 root root 4096 Aug 1 00:00 srv
dr-xr-xr-x 11 root root 0 Aug 11 16:45 sys
drwxrwxrwt 1 root root 4096 Aug 11 16:49 tmp
drwxr-xr-x 1 root root 4096 Aug 1 00:00 usr
drwxr-xr-x 1 root root 4096 Aug 2 06:17 var
drwxrwxrwx 1 root root 512 Aug 9 19:27 www
# groups www-data
www-data : www-data root
#
After that, as both users are in root group, they should have all permissions, don't they ?
I was following this video https://www.youtube.com/watch?v=gC8sLGB8SSM&index=77&list=PL442FA2C127377F07 . I am using fedora. I am able to read a file using this code:
$fileHandle = fopen('test.txt', 'r') or die('Unable to open test.txt');
echo fread($fileHandle, filesize('test.txt'));
But when I change 'r' to 'w', it dies and prints 'Unable to open test.txt'.
To check that I have permissions to read and write to a file, I typed this on terminal, ls -l /var/www/html. It showed:
total 8
-rwxr-xr-x. 1 Hemil apache 131 Jul 6 11:09 index.php
-rw-rw-r--. 1 Hemil Hemil 12 Jul 6 11:09 test.txt
I noticed that apache did not have the permission to read and write to a file, I did this: sudo chown Hemil:apache /var/www/html. But again when i checked the permissions, it prints the same as above.
EDIT: I forgot to add that I am not on a server. I am on localhost.
EDIT: On #Nic3500 's recommendation, i add the following:
ls -al /var:
total 108
drwxr-xr-x. 23 root root 4096 Apr 25 12:09 .
dr-xr-xr-x. 18 root root 4096 Jul 7 08:17 ..
drwxr-xr-x. 2 root root 4096 Apr 25 12:06 account
drwxr-xr-x. 2 root root 4096 Feb 7 15:11 adm
drwxr-xr-x. 17 root root 4096 Jul 5 10:21 cache
drwxr-xr-x. 2 root root 4096 May 31 10:46 crash
drwxr-xr-x. 3 root root 4096 Apr 25 12:06 db
drwxr-xr-x. 3 root root 4096 Apr 25 12:06 empty
drwxr-xr-x. 2 root root 4096 Feb 7 15:11 ftp
drwxr-xr-x. 2 root root 4096 Feb 7 15:11 games
drwxr-xr-x. 2 root root 4096 Feb 7 15:11 gopher
drwxr-xr-x. 3 root root 4096 Jun 15 03:23 kerberos
drwxr-xr-x. 59 root root 4096 Jul 5 11:55 lib
drwxr-xr-x. 2 root root 4096 Feb 7 15:11 local
lrwxrwxrwx. 1 root root 11 Apr 25 12:03 lock -> ../run/lock
drwxr-xr-x. 18 root root 4096 Jul 5 11:52 log
drwx------. 2 root root 16384 Jul 4 22:54 lost+found
lrwxrwxrwx. 1 root root 10 Feb 7 15:11 mail -> spool/mail
drwxr-xr-x. 2 root root 4096 Feb 7 15:11 nis
drwxr-xr-x. 2 root root 4096 Feb 7 15:11 opt
drwxr-xr-x. 2 root root 4096 Feb 7 15:11 preserve
lrwxrwxrwx. 1 root root 6 Apr 25 12:03 run -> ../run
drwxr-xr-x. 11 root root 4096 Apr 25 12:06 spool
drwxrwxrwt. 16 root root 4096 Jul 7 18:26 tmp
-rw-rw-r--. 1 root root 63 Apr 25 12:09 .updated
drwxr-xr-x. 4 root root 4096 May 1 14:24 www
drwxr-xr-x. 2 root root 4096 Feb 7 15:11 yp
ls -al /var/www
drwxr-xr-x. 4 root root 4096 May 1 14:24 .
drwxr-xr-x. 23 root root 4096 Apr 25 12:09 ..
drwxr-xr-x. 2 root root 4096 May 1 14:24 cgi-bin
drwxr-xr-x. 2 Hemil apache 4096 Jul 6 16:17 html
ls -al /var/www/html
drwxr-xr-x. 2 Hemil apache 4096 Jul 6 16:17 .
drwxr-xr-x. 4 root root 4096 May 1 14:24 ..
-rwxr-xr-x. 1 Hemil apache 102 Jul 7 16:55 index.php
-rw-rw-rw-. 1 Hemil apache 12 Jul 6 11:09 test.txt
all I struggle with one permission problem with my wordpress.
As you can see
ls -la wp-content/themes/impreza/
total 144
drwxr-xr-x 9 root root 4096 Oct 7 16:49 .
drwxr-xr-x 4 root root 4096 Oct 7 11:21 ..
-rwxr-xr-x 1 root root 330 Oct 7 10:33 404.php
-rwxr-xr-x 1 root root 340 Oct 7 10:33 archive.php
-rwxr-xr-x 1 root root 339 Oct 7 10:33 author.php
-rwxr-xr-x 1 root root 349 Oct 7 10:33 comments.php
drwxr-xr-x 2 root root 4096 Oct 7 16:48 config
drwxr-xr-x 2 root root 4096 Oct 7 10:33 css
drwxr-xr-x 10 root root 4096 Oct 7 10:33 demo-import
-rwxr-xr-x 1 root root 337 Oct 7 10:33 footer.php
-rwxr-xr-x 1 root root 355 Oct 7 10:33 forum.php
drwxr-xr-x 15 root root 4096 Oct 7 10:34 framework
drwxr-xr-x 3 root root 4096 Oct 7 10:34 functions
-rwxr-xr-x 1 root root 1105 Oct 7 10:33 functions.php
-rwxr-xr-x 1 root root 337 Oct 7 10:33 header.php
-rwxr-xr-x 1 root root 359 Oct 7 10:33 header-shop.php
-rwxr-xr-x 1 root root 361 Oct 7 10:33 index.php
drwxr-xr-x 2 root root 4096 Oct 7 10:33 js
-rwxr-xr-x 1 root root 325 Oct 7 10:33 page.php
-rwxr-xr-x 1 root root 18970 Oct 7 10:33 screenshot.png
-rwxr-xr-x 1 root root 388 Oct 7 10:33 searchform.php
-rwxr-xr-x 1 root root 344 Oct 7 10:33 search.php
-rwxr-xr-x 1 root root 645 Oct 7 10:33 single.php
-rwxr-xr-x 1 root root 365 Oct 7 10:33 single-us_portfolio.php
-rwxr-xr-x 1 root root 288 Oct 7 10:33 style.css
-rwxr-xr-x 1 root root 15056 Oct 7 16:49 us-logo.png
drwxr-xr-x 3 root root 4096 Oct 7 10:34 vendor
-rwxr-xr-x 1 root root 4341 Oct 7 10:33 wpml-config.xml
in my themes folder everything is with equals permissions but I can't access them all. For example
NOT VISIBLE - http://www.aniabuchi.com/wp-content/themes/impreza/us-logo.png
VISIBLE - http://www.aniabuchi.com/wp-content/themes/impreza/screenshot.png
The theme itself has activeted, but when I've try to active the plugins it say also "Please adjust file permissions to allow plugins installation".
This is my second wordpress installation and the only difference I've made is to use only one wp-contents folder
/* Default value for some constants if they have not yet been set
by the host-specific config files */
if (!defined('ABSPATH'))
define('ABSPATH', '/var/www/aniabuchi/');
if (!defined('WP_CORE_UPDATE'))
define('WP_CORE_UPDATE', false);
define('DB_HOST', 'localhost');
if (!defined('WP_CONTENT_DIR') && !defined('DONT_SET_WP_CONTENT_DIR'))
define('WP_CONTENT_DIR', '/var/www/aniabuchi/wp-content');
try to make images 777 to see if you can access them.
for plugin, you should check your "wp-content/plugins" folder permission, not themes.
You need to make sure the owner assigned to the files and directories is the web server user, otherwise wordpress will fail all plugin installations or updates regardless of file/folder permissions. On ubuntu/debian it's usually www-data, and on centos/rhel/fedora it's apache.
Try this and check - it might do the trick:
# chmod 755 -R <path_to_your_webroot_folder>
# chown root:root -R <path_to_your_webroot_folder>
for some reason my php installation refuses to load the config for the APC Op-Cache. But looking at phpinfo() every other config file in this directory is getting loaded. Permissions seem ok. below is a look at the directories and the config file itself. And i can confirm that apcu.so exists in the extensions directory as it should. Any ideas here? im stumped.
root#friends:/etc/php5/fpm/conf.d# ls -l
total 24
lrwxrwxrwx 1 root root 32 Apr 7 2014 05-opcache.ini -> ../../mods-available/opcache.ini
lrwxrwxrwx 1 root root 28 Apr 7 2014 10-pdo.ini -> ../../mods-available/pdo.ini
lrwxrwxrwx 1 root root 29 Aug 6 13:45 20-apcu.ini -> ../../mods-available/apcu.ini
lrwxrwxrwx 1 root root 29 Apr 9 2014 20-curl.ini -> ../../mods-available/curl.ini
lrwxrwxrwx 1 root root 27 Aug 6 2014 20-gd.ini -> ../../mods-available/gd.ini
lrwxrwxrwx 1 root root 29 Apr 8 2014 20-json.ini -> ../../mods-available/json.ini
lrwxrwxrwx 1 root root 31 Aug 6 2014 20-mcrypt.ini -> ../../mods-available/mcrypt.ini
lrwxrwxrwx 1 root root 34 Feb 2 2015 20-memcached.ini -> ../../mods-available/memcached.ini
lrwxrwxrwx 1 root root 30 Aug 6 2014 20-mssql.ini -> ../../mods-available/mssql.ini
lrwxrwxrwx 1 root root 31 Apr 7 2014 20-mysqli.ini -> ../../mods-available/mysqli.ini
lrwxrwxrwx 1 root root 30 Apr 7 2014 20-mysql.ini -> ../../mods-available/mysql.ini
lrwxrwxrwx 1 root root 34 Aug 6 2014 20-pdo_dblib.ini -> ../../mods-available/pdo_dblib.ini
lrwxrwxrwx 1 root root 34 Apr 7 2014 20-pdo_mysql.ini -> ../../mods-available/pdo_mysql.ini
lrwxrwxrwx 1 root root 33 Apr 7 2014 20-readline.ini -> ../../mods-available/readline.ini
-rw-r--r-- 1 root root 22661 Apr 22 15:11 newrelic.ini
root#friends:/etc/php5/fpm/conf.d# ls -l ../../mods-available/
total 56
-rw-r--r-- 1 root root 119 Aug 6 13:47 apcu.ini
-rw-r--r-- 1 root root 68 Apr 3 2014 curl.ini
-rw-r--r-- 1 root root 64 Jul 7 2014 gd.ini
-rw-r--r-- 1 root root 68 Aug 8 2013 json.ini
-rw-r--r-- 1 root root 58 Aug 6 2014 mcrypt.ini
-rw-r--r-- 1 root root 70 Dec 19 2012 memcached.ini
-rw-r--r-- 1 root root 71 Jul 7 2014 mssql.ini
-rw-r--r-- 1 root root 71 Apr 3 2014 mysqli.ini
-rw-r--r-- 1 root root 70 Apr 3 2014 mysql.ini
-rw-r--r-- 1 root root 83 May 2 2014 opcache.ini
-rw-r--r-- 1 root root 75 Jul 7 2014 pdo_dblib.ini
-rw-r--r-- 1 root root 66 Apr 3 2014 pdo.ini
-rw-r--r-- 1 root root 74 Apr 3 2014 pdo_mysql.ini
-rw-r--r-- 1 root root 76 Apr 3 2014 readline.ini
root#friends:/etc/php5/fpm/conf.d# cat ../../mods-available/apcu.ini
extension=apcu.so
apc.enabled=1
apc.shm_size=128M
apc.ttl=3600
apc.user_ttl=7200
apc.gc_ttl=3600
apc.max_file_size=1M
Here is my .htaccess content:
RewriteEngine On
RewriteRule ^([^/]*)\.html$ /mtd/index.php?page=$1 [L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)\.html$ /mtd/index.php?page=$1&destination=$2&package=$3 [L]
The following link works correctly:
http://localhost/mtd/our-company.html [Rewrite Rule 1]
The page successfully passes the $_GET values index.php?page=page-name
Yet, the following link is Showing 404 Error
http://localhost/mtd/tours/nepal/index.html [Rewrite Rule 2]
This URL should pass $_GET values like:
index.php?page=tours&destination=nepal&package=index
This was working on Windows 8.1 with XAMPP Server and Remote Server with cPanel, but after I shifted to Ubuntu (Latest) with LAMP Stack, it is no longer working.
after executing command ls -al
root#Neeraz:/var/www/mtd# ls -al
total 1740
drwxr-xr-x 15 neeraz root 4096 Jan 28 13:54 .
drwxrwxrwx 70 root root 4096 Jan 30 14:40 ..
drwxrwxrwx 10 root root 4096 Dec 17 15:56 admin
-rwxrwxrwx 1 root root 15992 Oct 23 12:25 ahome.html
-rwxrwxrwx 1 root root 3226 Nov 24 14:23 booknow.php
drwxrwxrwx 3 root root 4096 Jan 6 22:45 css
-rwxrwxrwx 1 root root 621280 Aug 15 15:56 delight-mockup.jpg
-rwxrwxrwx 1 root root 2531 Dec 10 17:47 find.php
-rwxrwxrwx 1 root root 1544 Nov 24 15:20 HandleTour.php
-rwxrwxrwx 1 root root 346 Feb 3 10:28 .htaccess
drwxrwxrwx 3 root root 4096 Jan 5 15:54 images
drwxrwxrwx 2 root root 4096 Oct 24 18:59 img
-rwxrwxrwx 1 root root 12098 Dec 16 14:00 index1.php
-rwxrwxrwx 1 root root 12372 Jan 29 06:20 index.php
drwxrwxrwx 2 root root 4096 Dec 23 15:15 jquery
drwxrwxrwx 3 root root 4096 Jan 28 13:58 Libs
-rwxrwxrwx 1 root root 13156 Jan 28 14:13 MainPage.php
-rwxrwxrwx 1 root root 1211 Jan 5 22:29 menu0.php
-rw-rw-r-- 1 neeraz neeraz 642 Jan 28 13:57 menulayout.php
-rwxrwxrwx 1 root root 476327 Aug 16 16:08 mt-delight1.jpg
-rwxrwxrwx 1 root root 474429 Aug 16 16:07 mt-delight.jpg
drwxrwxr-x 3 neeraz neeraz 4096 Jan 28 11:35 nbproject
-rwxrwxrwx 1 root root 9892 Sep 19 10:46 nepal.html
drwxrwxrwx 2 root root 4096 Jan 7 00:27 _notes
-rwxrwxrwx 1 root root 684 Oct 25 09:00 PagesLoader.php
-rwxrwxrwx 1 root root 1189 Nov 21 00:00 pie.php
drwxrwxrwx 2 root root 4096 Oct 29 18:16 SpryAssets
-rwxrwxrwx 1 root root 45 Dec 17 16:02 test.php
drwxrwxrwx 2 root root 4096 Dec 29 14:19 TourGallery
-rwxrwxrwx 1 root root 9266 Sep 5 13:29 tour.html
-rwxrwxrwx 1 root root 18333 Jan 5 14:05 tours.php
drwxrwxrwx 2 root root 4096 Oct 27 16:18 TrekkingMap
drwxrwxrwx 3 root root 4096 Dec 29 14:19 uploaded
drwxrwxrwx 2 root root 4096 Dec 15 19:39 uploads
root#Neeraz:/var/www/mtd#
You need correct RewriteBase and make to place this rule in /mtd/.htaccess:
RewriteEngine On
RewriteBase /mtd/
RewriteRule ^([^/]+)/([^/]+)/([^/.]+)\.html$ index.php?page=$1&destination=$2&package=$3 [L,QSA]
RewriteRule ^([^/.]+)\.html$ index.php?page=$1 [L,QSA]