How do I redirect apache on Ubuntu server to serve the index.php file? -


i found similar question on stack overflow , tried following directions specified there redirecting request example.com load /var/www/example.com/public_html/index.php

i trying setup friendly urls.
on ubuntu, have vhost file inside /etc/apache2/sites-available/example.com.conf

if put directoryindex index.php in there, fails restart apache. use a2ensite command on ubuntu create simlink sites-enabled directory.

i tried putting directoryindex index.php index.html index.pl in /etc/apache2/mods-available/dir.conf file still doesn't load php file exists in directory /var/www/example.com/public_html , try load example.com in browser. read somewhere posting on stack overflow should use example.com in place of actual domain name.

i found post on using .htaccess file redirect index.html index.php. trying achieve have example.com serve index.php.

logic suggested if edit /etc/apache2/mods-available/dir.conf , put index.php first , put other file types, mime-types after that, prefer index.php on index.html

here .htaccess file:

options +followsymlinks directoryindex index.php  rewriteengine on  rewritecond %{the_request} ^[a-z]{3,9}\ /.*index\.php\ http/ rewriterule ^(.*)index\.php$ /$1 [r=301,l]  rewritecond %{the_request} ^[a-z]{3,9}\ /.*index\.html\ http/ rewriterule ^(.*)index\.html$ /$1index.php [r=301,l] 

this in directory /var/www/example.com/public_html documentroot domain trying serve. can tell me doing wrong? or how right? thanks, bruce


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -