I purchased yesterday a virtual private server with PHP version 5.3.3
Then i upgraded my php version to 5.4.22
Now the htaccess doesnt functional normally.. It doesn't do anything.
What i tried:
I did this in my httpd.conf
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
And it didn't work so i tried this in my .htaccess:
<FilesMatch "\.(inc|php|php3|php4|php5|php6|phtml|phps)$">
SetHandler x-httpd-php54
</FilesMatch>
And this doesn't work either.
If i create a page with <?php phpinfo() ?> and i check the loaded modules i see that mod_rewrite is loaded.
My .htaccess
<FilesMatch "\.(htaccess|htpasswd|ini|log|sh|inc|bak)$">
Order Allow,Deny
Deny from all
</FilesMatch>
RewriteEngine on
RewriteRule ^d/(.*)$ delete.php?img=$1 [L]
RewriteRule ^i/(.*)$ i.php?img=$1 [L]
RewriteRule ^e/(.*)$ editor.php?img=$1 [L]
RewriteRule ^u/$ /u/index.php?img=$1
RewriteRule ^([a-zA-Z0-9]*)$ getimage.php?image=$1
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule \.(gif|jpeg|png|bmp|jpg) http://(ip)/6j5o [NC,L]
ErrorDocument 400 http://(ip)/404.php
ErrorDocument 401 http://(ip)/404.php
ErrorDocument 403 http://(ip)/404.php
ErrorDocument 404 http://(ip)/404.php
ErrorDocument 500 http://(ip)/404.php
Any ideas? (My server is a Centos 6 64bit)
Your Apache config is at /etc/httpd/conf/httpd.conf. Make sure this line is not commented out
LoadModule rewrite_module modules/mod_rewrite.so
Now, head over to /etc/httpd/conf.d and look at the config for your site (I hope you've made your own sitename.conf in here). You should have something like this (yours will probably differ a fair amount, this is from a server hosting one site)
<VirtualHost *:80>
DocumentRoot /var/www/html/mydir
ServerName my.domain.name
ServerAlias my.domain.name
ErrorLog logs/mydomain
CustomLog logs/mydomain common
<Directory "/var/www/html/mydir">
Allow from all
Options +FollowSymLinks
</Directory>
</VirtualHost>
Make sure you use full path names to your site's root directory.
Related
I am using WAMPServer as developping locally. I have a problem in redirecting pages with .htaccess
my .htaccess file is in root folder.
I have decommented the
LoadModule rewrite_module modules/mod_rewrite.so
rewrite_module is enabled in apache.
But it still does not work.
Note: it works in MAMP server as I checked but not in WAMP.
here is my .htaccess file.
# I tried both below solutions which found on internet but none of them worked
# - Options +FollowSymLinks -MultiViews
# - Options -Indexes -MultiViews
RewriteEngine On
RewriteRule ^home$ /SiteTemplate/index.php [L]
RewriteRule ^users$ /SiteTemplate/users.php [L]
RewriteRule ^addUser$ /SiteTemplate/registration.php [L]
in may httpd.conf it's like this.
# <Directory />
# AllowOverride none
# Require all denied
# </Directory>
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>
Anybody can help please ?
I'm using wamp server 3.0.4 and apache version 2.4.18.I want to redirect 404 pages to custom pages. I have enabled LoadModule rewrite_module modules/mod_rewrite.so in apache/conf/httpd.conf and changed in apache/conf/httpd.conf:
<Directory "c:/wamp64/www/">
Options +Indexes +FollowSymLinks
AllowOverride all #none to all
Require local
</Directory>
In httpd.vhost
<VirtualHost *:80>
ServerName testblog
DocumentRoot c:/wamp64/www/testblog
<Directory "c:/wamp64/www/testblog/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
and restart the server.
In my htaccess file I have the following code
ErrorDocument 404 https://www.test.com/not-found.html
RedirectMatch 301 /learn https://www.test.com/not-found.html
But not able to redirect .What I missed here
Keep mod_rewrite enabled and then trying this in your .htaccess file:
Add the following to it at the top:
RewriteEngine On
RewriteBase /
RewriteRule ^learn https://www.test.com/not-found.html [R=302,L]
RedirectMatch uses mod_alias, so make sure you have enabled that, it should be enabled automatically, but rarely it might not be, so enable it and try your redirect. Even after that, if it does not work, stick with the above. Let me know if you have any questions.
I have a virtualhost configurated like this:
<VirtualHost *:80>
ServerAdmin name#ganydomain.com
DocumentRoot "C:/xampp/www/portal/web"
ServerName portal
<Directory "C:/xampp/www/portal/web">
Require all granted
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
</Directory>
<Directory /var/www/project/web/bundles>
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
</Directory>
<Files ~ "\.php$">
Options Indexes FollowSymLinks ExecCGI
AddHandler fcgid-script .php
FcgidWrapper "C:/Xampp/php-7.1.8-nts/php-cgi.exe" .php
</Files>
</VirtualHost>
I'm not sure it is properly well conigurated because I have 6 processes working and sometimes I get an 500 error with the following messatge at the bottom: Apache/2.4.17 (Win32) OpenSSL/1.0.2d PHP/5.6.14 mod_fcgid/2.3.9. I its weird seeing php5.6 here because it is the principal version installed in this Apache (it is sol old) but not uset in this virtualhost.
If somebody can give me any tip I would appreciate it so much.
Has a fresh setup of Apache 2.2 + PHP 5.3. Trying to run Yii site, which requires .htaccess file to be as following:
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
But instead of running index.php file it lists the directory.
What I know:
.htaccess is being read and processed - if you break it, you get 500 IE.
mod_rewrite is On: LoadModule rewrite_module modules/mod_rewrite.so
PHP is up, I was able to run Adminer w/o any issues
Virtual Hosts file looks fine (see below)
httpd-vhosts.conf:
<VirtualHost *:80>
DocumentRoot "d:/denis/www/yii.local"
ServerName yii.local
ErrorLog "logs/yii.local-error.log"
CustomLog "logs/yii.local-access.log" common
# Other directives here
# DirectoryIndex index.php
<Directory "D:/denis/www/yii.local">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
#AccessFileName htaccess
</VirtualHost>
Update: If I add Options -Indexes to .htaccess I am getting 403 Forbidden, due to "Directory index forbidden by Options directive".
I'm working on a symfony 1.4 project which is working, i wanted to work on a local copy on my personal machine; so I've settled a virtual host (I'm on a Windows 8.1 with xamppp web server).
I'm getting a 500 error when trying to access from browser by giving "joyaa" (it's the virtualhost alias), and in some of my test I had a redirect to the project working on the server (it's a statement in .htaccess)
This is the virtual host defining:
<VirtualHost *:80>
ServerName joyaa
DocumentRoot "C:/xampp/htdocs/yaol/web"
DirectoryIndex index.php
<Directory "C:/xampp/htdocs/yaol/web">
AllowOverride All
Allow from All
</Directory>
Alias /sf C:/xampp/htdocs/yaol/lib/vendor/symfony/data/web/sf
<Directory "C:/xampp/htdocs/yaol/lib/vendor/symfony/data/web/sf">
AllowOverride All
Allow from All
</Directory>
Alias /joyaa "C:/xampp/htdocs/yaol/web"
<Directory "C:/xampp/htdocs/yaol/">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
and this is the .htaccess defining:
Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /joyaa
RewriteRule ^yaol(.*)$ http://www.arcadja.com/joyaa$1 [L,R=301]
# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
# no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
Probably it's a configuration problem but I'm not sure about where to look at... Please help. Thanks