phalcon routing does not work properly - apache

I am having the same issue
My .htaccess file in project/ is
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
server : apache
and the command "a2enmod rewrite" shows that "Module rewrite already enabled"
when i point the browser to project folder i can see the folder structure , when i point to project/public then i can see "Hello world." I am using ubuntu elementary os. Am i Following correctly or is there any error in my installation.

when i point the browser to project folder i can see the folder structure , when i point to project/public then i can see "Hello world."
your server should be configured so you can't see the project folder from the browser, the root of your virtualhost should be the public folder

Is IfModule closed?
What you see when you go to another uri? Phalcon's error or Apache 404?
Try to disable mod rewrite, restart apache and then enable it again
a2dismod rewrite
service apache2 restart
a2enmod rewrite
service apache2 restart
I get this error to, but i don't know exactly how i fix it...

Related

Deploy React Js app on Apache Server Linux environment

I am able to deploy react app on apache server, to login and the home page displays. All links work properly.
The problem occurs when I refresh the page (using F5). It says:
The requested URL /home was not found on this server.
I did almost everything like RewriteEngine set to On in .htaccess file.
RewriteEngine On RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
RewriteRule ^ /index.html [L]
Am I missing something?
You .htaccess seems okay, but it might be ignored by Apache.
You should
Check if AllowOverride is set to All for the Directory you're serving the website from (in your Apache vhost configuration file, under /etc/apache2/sites-enabled)
Check if the rewrite mod is enabled (enable it with sudo a2enmod rewrite, then restart Apache with sudo systemctl restart apache2)

htaccess mod rewrite not working

My server has an SSL setup on it and it has a site on there viewable in the browser via an IP.
I have an .htaccess file on the root with the following in it:
RewriteEngine on
RewriteRule ^single/([^/]*)$ single.php?url=$1 [L]
When I view the site URL:
https://100.100.100.100/single/test
I get a 404 not found. I have tried the actual URL:
https://100.100.100.100/single.php?url=test
And that works exactly as it should? Please note that isn't the actual IP
It works perfectly on a shared host. I have checked the server config and the Apache Mod rewrite is enabled.
You need the Query String Appended flag.
Try:
RewriteRule ^single/([^/]+) http://yourdomain.com/single.php?url=$1 [QSA]

Apache ignore *.php files in rewrite directives but not other extensions

I'm trying to test some simple rewrite directives in .htaccess file on my test environment with Apache and PHP-FPM.
It seems that a simple rewrite rule works well for any type of file but not for *.php files.
This works :
RewriteEngine On
RewriteRule ^sandbox/video\.html?$ http://www.google.fr? [R,L]
But this not :
RewriteEngine On
RewriteRule ^sandbox/video\.php?$ http://www.google.fr? [R,L]
I run Apache 2.2 and PHP-FPM inside a VM on Debian
Could it be related ?
Thanks for your help
With PHP-FPM the .htaccess file is never read for php URL. You will need to add the rewrites to your main config.

apache configure site maintainance page

I am trying to configure in apache httpd.conf for the below scenario. Can anyone please advise how to do it.
When the apache instance is up and some one tries to hit below url
http://mydomain.com/xxx
It should display content exists in sitemaintenance.html without changing url context path.
Assume sitemaintenance.html resides in /usr/local/apache/my-apache-instance/htdocs/sitemaintenance.html
Here xxx is a subdomain which is hosted separately from main domain (mydomain.com).
-KS
Try placing this into httpd.conf or .htaccess for your sub-domain:
RewriteEngine on
RewriteCond /usr/local/apache/my-apache-instance/htdocs/sitemaintenance.html -f
RewriteRule ^.*$ /sitemaintenance.html [PT,L]
The condition in RewriteCond enables rewrite only if that file exists, so you can dynamically add or delete it, without re-starting Apache or changing .htaccess.

WAMP Apache rewrite issue in .htaccess

I am working in a WAMP environment trying to create a bare bones front controller and have started with creating an .htaccess file in my project root (i.e. www/molecule/ The .htaccess contains:
Options +FollowSymLinks
IndexIgnore */*
# Turn on the RewriteEngine
RewriteEngine On
# Rules
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
Apache rewrite_module is enabled in my WAMP settings, and also uncommented in the httpd.conf, but getting an Internal Server Error when I try to load any pages with that .htaccess in the directory. The Apache Error log reads:
[alert] [client 127.0.0.1] C:/wamp/www/molecule/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
Can someone point me in the right direction?
It looks like you didn't turn on your mod_rewrite module. Find your httpd.conf file and do a search for mod_rewrite, the line should look something like this:
LoadModule rewrite_module modules/mod_rewrite.so
Make sure you uncomment that by removing the # in front of it.
if it is related to hosting site then ask to your hosting company or if you want to enable it in wamp local machine then check this youtube step by step tutorial related to enabling rewrite module in wamp apache
https://youtu.be/xIspOX9FuVU?t=1m43s
Wamp server icon -> Apache -> Apache Modules and check the rewrite module option
it should be checked but after that restart all services in wamp