How to load themes file properly using php - php

Talking about my project I am working, its just a simple website in localhost.I am Xampp server rand inside htdocs my website is in file creative which contains index.php file and another sub directory themes which further contains themes folder which contain all the necessary html php and css files that builds my websites.
When a user enters I want to redirect him from the index.php in localhost/creative to the index.php in localhost/creative/themes/theme-folder. I tried to use require_once('creative/themes/theme-folder/index.php'); but in most of cases it fails. is there any other way to do so.

You can modify the .httpd file.
Then you add:
#The path of your repositories:
DocumentRoot "C:/xampp/htdocs/creative"
#then you make an alias:
Alias /creative "C:/xampp/htdocs/creative/themes/theme-folder"
<Directory "C:/xampp/htdocs/creative/themes/theme-folder">
#Modify this data according to your needs
Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>

Related

files and images outside html folder

I have moved website from one hosting to another and due to security, PCI and HIPPA reason, I need to move some (files and images) directories outside html folder.
Previous structure : /public_html/uploads
Current structure : /var/www/uploads
For Files : /var/www/html/
I want to know how I can handle uploaded images and images get to display on front page.
Thanks
You could use symbolic links e.g.:
in /var/www/html execute ln -s /var/www/uploads image_uploads then all your images can be referenced with <img src="/image_uploads/some_image_name.jpg">
Be aware than you may need to set alternative permissions in a <Directory> section in your site configuration (I am assuming that you are using Apache).
Something like
<Directory "/var/www/uploads">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
See the Apache documentation for Directory for more information.

Access files in home folder with PHP (linux)

I have a php application located in /var/www/phpapp and I need to create links to download files located in the /home/myuser folder. The complete path to the files is stored in a database, so the goal is for the app to place a link like Download 1 and be able to download it. I access the php app using http://localhost/phpapp. I know I can do this using alias in apache but I still haven't figure it out.
For anyone having this same problem, I got it working using this:
In Ubuntu: I went to /etc/apache2/sites-enabled/ and edit the site file
In Centos: Go to /etc/httpd/conf.d/ and add a new xxxx.conf file
And I added this into the file:
Alias /home "/home/user/"
<Directory "/home/user">
Options None
AllowOverride None
Order allow,deny
Allow from all
Options Indexes FollowSymLinks
MultiViews Require all granted
</Directory>

Codeigniter - Same name for root directory and view conflict

Stuck into a strange situation while upgrading the website to Codeigniter.
http://website.com/download - View .php page
http://website.com/download/files - Directory
If I allow directory within the .httaccess file, view stops working. Similarly, when I disallow directory, view works but directory URL throws error.
Please help
U can configure in virtual host setting.
Allow directory listing.
<Directory /usr/local/apache2/htdocs/listme>
Options +Indexes
</Directory>
Disable directory listing.
<Directory /usr/local/apache2/htdocs/dontlistme>
Options -Indexes
</Directory>

XAMPP DirectiveIndex issue (php development)

I'm having an issue with using XAMPP and the ability to use an includes folder in php etc. I'm learning how to use a single point access for my php files, by that I mean, you put only an index.php in the main folder to be accessed and it is it use classes that are located in the Includes folder outside the public_php folder.
Here is the current config inside the httpd.conf (located in the apache2 folder)
Here is the current config :
Alias /bitnami/ "/Applications/XAMPP/xamppfiles/apache2/htdocs/"
Alias /bitnami "/Applications/XAMPP/xamppfiles/apache2/htdocs"
<Directory "/Applications/XAMPP/xamppfiles/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex index.html index.php
</Directory>
Here is a screenshot of my file structure, is someone able to help me on how to use the DirectoryIndex setting so that my program is able to just use the require_once 'bla/bla.php';
Thanks for any contribution given.
require_once (and it's other variations) include files locally.
You don't have to use your alias to access them, just write the full local path:
if you file is located at /Applications/XAMPP/bla/bla.php:
require_once('/Applications/XAMPP/bla/bla.php');

Providing downlaod link to file in non-public section of server

I have a number of files stored in a folder outside of the publicly accessible portion of my website.
For example, the file 'abcd.jpg' is stored (in terms of the server) in '/home/private_files/' and the website is in '/home/public_html/website.com/'
When I go to provide a link to view the file, I use
Download however this doesn't work.
Any suggestions?
If you are using Apache as the server, you can set it to alias a directory in httpd.conf...
Alias /images/ "/home/private_files/"
<Directory "/home/private_files/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</IfModule>
and you can use this
Download
You can not access to directory that located in out of www.
use symlink to link to file:
ln -s /home/private_files/abcd.jpg /home/www/abcd.jpg
and delete the link after deadline(something like rapidshare)
or use file downloader like this

Categories