I'm trying to configure friendly URLs on my site, and get following error in my Apache error.log:
[Tue Mar 20 18:41:39 2012] [error] [client 127.0.0.1] script 'C:/EasyPHP/www/index.php' not found or unable to stat
I access my site like this: http://localhost/mysite
Site files are here: d:\Sites\php\projects\mysite\public_html\
My .htaccess file:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
I'm using EasyPHP 5.3.9 and Yii framework.
I've also uncommented this line in httpd.conf:
LoadModule rewrite_module modules/mod_rewrite.so
This has nothing to do with RewriteRule, it has to do with your EasyPhp installation. Just make sure that the website is properly configured (check for the vhosts configuration or maybe if there's only one site, the httpd.conf configuration).
Check the /protected/config/main.php file in the yii project and uncommnet the url manager. Here's some help -> http://www.yiiframework.com/doc/blog/1.1/en/final.url
Related
I hope that this question is not a duplicate, but I only found articles or questions about this for old versions of Symfony. I am new to Symfony 4 and I would like to create a new application with it and install it as a part of an already existing website (domain below). The Sf 4 app goes into the admin/ subdirectory shown in the hierarchy below. domain uses the TYPO3 CMS, but I’m not sure that it matters for this question.
First, here is the directory structure :
/home/webuser/domain/
public/ (this is the document root for "domain.localhost")
admin/ (the Symfony app goes here)
public/
…
…
typo3/
.htaccess
index.php
…
composer.json
I am currently working on the website on my local machine and I would like to access the Symfony application root from domain.localhost/admin. I am using an Apache virtual host and the domain/public folder is the document root of domain :
<VirtualHost *:80>
ServerName domain.localhost
DocumentRoot "/home/webuser/www/domain/public"
</VirtualHost>
I tried adding the following rewrite rule to my VirtualHost :
<VirtualHost *:80>
ServerName domain.localhost
DocumentRoot "/home/webuser/www/domain/public"
RewriteEngine On
RewriteRule "^/admin/(.*)$" "/admin/public/$1"
LogLevel trace1
</VirtualHost>
But this seems to work only when I visit http://domain.localhost/admin/ : I then see the "Welcome to Symfony 4.2.7" page. As soon as I try to visit a subpage, I get a 404 error. I tried to create my first page at lucky/number as explained in the documentation here, and looking at the Apache error log, I have lines such as :
[Mon Apr 29 18:52:09.472043 2019] [rewrite:trace1] [pid 22250:tid 140404453660416] mod_rewrite.c(483): [client ::1:43084] ::1 - - [domain.localhost/sid#55a33c704bf8][rid#7fb260002bd0/initial] [perdir /home/webuser/www/domain/public/] pass through /home/webuser/www/domain/public/admin/public/lucky
[Mon Apr 29 18:52:09.472087 2019] [core:info] [pid 22250:tid 140404453660416] [client ::1:43084] AH00128: File does not exist: /home/webuser/www/domain/public/admin/public/lucky/number
Now, TYPO3 has an .htaccess file containing URL rewrites, but I don’t think that they are interfering. Below, I just added myself the admin/ folder in the rule after the comment that starts with "Stop rewrite processing", so that we are not redirected to the home page of the domain website when the file is not found :
<IfModule mod_rewrite.c>
# Enable URL rewriting
RewriteEngine On
# Store the current location in an environment variable CWD to use
# mod_rewrite in .htaccess files without knowing the RewriteBase
RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
RewriteRule ^.*$ - [E=CWD:%2]
# Rule for versioned static files, configured through:
# - $GLOBALS['TYPO3_CONF_VARS']['BE']['versionNumberInFilename']
# - $GLOBALS['TYPO3_CONF_VARS']['FE']['versionNumberInFilename']
# IMPORTANT: This rule has to be the very first RewriteCond in order to work!
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ %{ENV:CWD}$1.$3 [L]
# Access block for folders
RewriteRule _(?:recycler|temp)_/ - [F]
RewriteRule fileadmin/templates/.*\.(?:txt|ts)$ - [F]
RewriteRule ^(?:vendor|typo3_src|typo3temp/var) - [F]
RewriteRule (?:typo3conf/ext|typo3/sysext|typo3/ext)/[^/]+/(?:Configuration|Resources/Private|Tests?|Documentation|docs?)/ - [F]
# Block access to all hidden files and directories with the exception of
# the visible content from within the `/.well-known/` hidden directory (RFC 5785).
RewriteCond %{REQUEST_URI} "!(^|/)\.well-known/([^./]+./?)+$" [NC]
RewriteCond %{SCRIPT_FILENAME} -d [OR]
RewriteCond %{SCRIPT_FILENAME} -f
RewriteRule (?:^|/)\. - [F]
# Stop rewrite processing, if we are in the typo3/ directory or any other known directory
# NOTE: Add your additional local storages here
RewriteRule ^(?:typo3/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico|admin/) - [L]
# If the file/symlink/directory does not exist => Redirect to index.php.
# For httpd.conf, you need to prefix each '%{REQUEST_FILENAME}' with '%{DOCUMENT_ROOT}'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^.*$ %{ENV:CWD}index.php [QSA,L]
</IfModule>
The production server will be a dedicated system, so I can modify anything I want.
It turns out that I just needed to install the Apache pack, like in this answer
My server isnt loading direct links on its header of html pages.Where dev.pauloxavier.com is an alias for 127.0.0.1. Example:
http://dev.pauloxavier.com/certified/framework/assets/css/custom.css
http://dev.pauloxavier.com/certified/framework/assets/css/bootstrap.css
I cant access this file direct on the browser, either. Error 500 is returned.
On the log of errors i got:
[Mon May 11 12:26:28.724782 2015] [cgi:error] [pid 2864:tid 1828] (9)Bad file descriptor: [client 127.0.0.1:51598] AH01222: don't know how to spawn child process: E:/GitHub/certified/framework/assets/img/favicon.png, referer: http://dev.pauloxavier.com/certified/
My htaccess file:
RewriteEngine On # Turn on the rewriting engine
RewriteBase /certified/
RewriteRule ^user/([a-z]+)/?$ user.php?id=$1 [L]
RewriteRule ^([0-9a-zA-Z-_]{1,100})/?$ index.php?to=$1 [L]
RewriteRule ^import/([0-9a-zA-Z-_]{1,100})/?$ index.php?to=import&id_evento=$1 [L]
RewriteRule ^evento/([0-9a-zA-Z-_]{1,100})/?$ index.php?to=evento&id_evento=$1 [L]
RewriteRule ^inserir/([0-9a-zA-Z-_]{1,100})/?$ index.php?to=inserir&id_evento=$1 [L]
RewriteRule ^remover/([0-9a-zA-Z-_]{1,100})/([0-9a-zA-Z-_]{1,100})/?$ index.php?to=remover&id_evento=$1&id_participante=$2 [L]
RewriteRule ^envio/([0-9a-zA-Z-_]{1,100})/?$ index.php?to=envio&id_evento=$1 [L]
RewriteRule ^certificado/([0-9a-zA-Z-_]{1,100})/([0-9a-zA-Z-_]{1,100})/?$ index.php?to=certificado&evento=$1&particip=$2 [L]
My directory on apache is configured as:
<Directory "E:/GitHub/certified">
AllowOverride All
Require all granted
Allow from all
</Directory>
And using the alias:
ScriptAlias /certified/ "E:/GitHub/certified/"
What is most strange is: This version is working on my webserver, and used to work on my local, but i lost my hd, and had to reinstall everything from scratch. I really think that is a problem with apache, like a misconfig.
Thanks in advance!
I have installed silverstripe using composer
composer create-project silverstripe/installer /var/www/
When I go to local host I get "Internal Server Error".
The apache2 error.log file gives me:
[Sat Apr 11 19:12:21.824829 2015] [core:error] [pid 3250] [client 127.0.0.1:58951] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
A friend suggested it might be a permissions issue, we tried
sudo chown -R www-data:www-data /var/www
Which didn't work.
Any ideas?
p.s. I'm new to web dev and have tried a few IRC channels for help.
There could be one of these
a misconfigured .htaccess file (or VirtualHosts) that causes recursive requests being made. Try this snippet for the respective file of yours.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /index.php/$1 [L,QSA]
</IfModule>
wrong permissions. Try to set the permission set of *.php files to 0644 or 0755
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
I am bigginer to php and i was trying to implement Model-View-Controller in php i updated allow override to all and created a .htacess file and wrote the following quotes in it,
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?url=$1 {QSA,L}
but i gave me 500 error and i went straight to apache error log and got these errors:
[Mon Apr 09 01:18:36 2012] [alert] [client ::1] C:/wamp/www/.htaccess: Invalid command 'RewriteEngine', perhaps
misspelled or defined by a module not included in the server configuration
I googled and googled but cant find it, i just want to pass all the request to index.php file i watched a video on youtube it was working fine in his computer but not on mine, he told i should modify something in php.ini but i don't know whats that, if i write the following in .htacess:
ErrorDocument 404 /404.php
ErrorDocument 500 /500.php
and goto url that dont exists, then it is controlled by 404.php but it i tried to write the first script then i gives me 500 error every time... Previously i also tried to install zend framework but still there was same error....
I apologize for my language,,,
thanks in advanced... please help...
Is your rewrite module in apache enabled? You can enable it in httpd.conf file in your installation dir. If you are using windows just uncomment the rewrite module line and restart your apache.
You can google "enable apache rewrite" for more information.
You need to enable mod_rewrite. Either by 'a2enmod rewrite' or by adding manually to httpd.conf