Re-setting up working project on local machine - php

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

Related

Hot to setup 2 different wordpress project with same domain on AWS Linux

currently i want to setup 2 different Wordpress project on my AWS Linux 2. but i still want to use a same domain. but i stuck.
1st Wordpress project use domain http://domainname.com
2nd wordpress project use domain http://domainname.com/second
what i have done is like this
1st Wordpress project
i set the .htaccess with this.. this setting is avoid 404 page when access http://domainname.com/second
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} !^/second/.*$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ./ /index.php [L]
</IfModule>
i also create a file "domainname.conf" on folder "/etc/httpd/conf.d/" with this setting
<VirtualHost *:80>
ServerName domainname.com
ServerAdmin email#gmail.com
DocumentRoot "/var/php_apps/domainname"
<Directory "/var/php_apps/domainname">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
ErrorLog /var/log/apache2/bar.error.log
LogLevel warn
CustomLog /var/log/apache2/bar.access.log combined
</VirtualHost>
this setting can load the page corretly. but i still can't display the 2nd wordpress project.. here is my setting
2nd Wordpress project
i set the .htaccess file with this
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
i create a file "second.conf" on folder "/etc/httpd/conf.d/" with this setting
<VirtualHost *:80>
ServerName domainname.com/second
ServerAdmin email#gmail.com
DocumentRoot "/var/php_apps/second"
<Directory "/var/php_apps/second">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
ErrorLog /var/log/apache2/bar.error.log
LogLevel warn
CustomLog /var/log/apache2/bar.access.log combined
</VirtualHost>
but the 2nd wordpress project can't load the page when access domain http://domainname.com/second
error display
Not Found
The requested URL was not found on this server.
how do i able load the page from 2nd wordpress project when access domain http://domainname.com/second ?
please help.

Configuring Symfony 5 Application on Apache server

I need some help with configuring Symfony on apache2 web server.
My current project category structure is:
var/www/domain.com/public_html
Inside public_html is where my Symfony application is located.
I am stuck at figuring our what I am doing wrong in my either .htaccess or /etc/apache2/sites-available/domain.com.conf files.
I am using symfony/apache-pack. My .htaccess files live inside /public folder as per documentation. Here it is:
DirectoryIndex index.php
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$
RewriteRule .* - [E=BASE:%1]
RewriteCond %{HTTP:Authorization} .+
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
RewriteCond %{ENV:REDIRECT_STATUS} =""
RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ %{ENV:BASE}/index.php [L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 307 ^/$ /index.php/
</IfModule>
</IfModule>
And here is my /etc/apache2/sites-available/domain.com.conf
<VirtualHost *:80>
ServerAdmin someemail#example.com
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot /var/www/mydomain.com/public_html/public
<Directory /var/www/mydomain.com/public_html/public>
AllowOverride All
Order allow,deny
Allow from All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.mydomain.com [OR]
RewriteCond %{SERVER_NAME} =mydomain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
I also read this and updated 000-default.conf as follows:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerAlias www.mydomain.com
DocumentRoot /var/www/mydomain.com/public_html/public
<Directory /var/www/domain.com/public_html/public>
Options FollowSymlinks MultiViews
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
Allow from All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<IfModule mod_dir.c>
DirectoryIndex index.php index.pl index.cgi index.html index.xhtml >
</IfModule>
</VirtualHost>
For the moment I am still seeing symfony project folder structure.
I tried:
inside .htaccess changing DirectoryIndex to /public/index.php
inside .conf file changin DocumentRoot to /va/www/domain.com/public_html/public
tried clearing cache
SO far nothings seems to help.
Would be extremely helpful for any advice.
I see that you are editing vhost which begins with
<VirtualHost *:80>......
That mean your website should be reachable by 80 port or in other words by http protocol. But! If in reality you are accessing your website by https protocol then make sure you are editing right Apache2 .conf file.
If the website is reachable by https protocol (especially if you use LetEncrypt), then try locating /etc/apache2/sites-available/....-le-ssl.conf config file (or similar one with corresponding domain title and with ssl prefix or postfix in it's name).
After editing that file do not forget to restart Apache2 webserver with $sudo service apache2 restart and test website again.

WampServer Site URL not working without localhost prefix

I was using Wamp 2.4 but had to uninstall it and install 3.0.6 alongside the 3.0.8 update. Everything works fine by selecting the Add localhost option in the wamp tray setting and stating /mysitefolder/ in the .htaccess and http//localhost/mysitefolder in the config files of the application.
But I like the idea of using virtualhost especially with the GUI form provided to create VH via an interface. I created a VH of a project I was working on prior to version 3.0.6 installation. Now I edited the .htaccess and config file of codeigniter code I was working with so that rather than localhost/mysitefolder as default I can now navigate to http://mysitefolder.
The problem: pointing to http://mysitefolder displays rightly but clicking any of the links to subpages results in the same browser error:
"Not Found The requested URL /mysitefolder.txt/index.php was not found
on this server. Apache/2.4.23 (Win32) PHP/5.6.25 Server at
mysitefolder Port 80"
First I don't understand where the .txt extension is emanating from and I don't know how to go about fixing this.
Working with Windows 8.1, Apache 2.4.3 with mod rewrite selected.
Kindly advise.
APACH VHOST FILe
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot c:/wamp/www
<Directory "c:/wamp/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName financejobs
ServerAlias financejobs
DocumentRoot "c:/wamp/www/financejobs"
<Directory "c:/wamp/www/financejobs">
AllowOverride All
Require local
</Directory>
</VirtualHost>
Codeigniter Application HTACCSS (for financejobs)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /financejobs/
RewriteCond %{REQUEST_URI} ^jp_sys.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^jp_app.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
Options -Indexes
Here's the answer:
Try changing RewriteBase /financejobs/ to RewriteBase /

Apache looks for index.php files in Laravel 5

I am a begginer in Laravel and I am having troubles with Apache 2.2.15 on CentOS 6.5 and Laravel 5. I have searched for this error and I found some solutions for .htaccess and for httpd.conf but none of them are working and i get this error when trying to access "public/auth/register" or "public/auth/login" and even "/home":
Not Found
The requested URL /index.php was not found on this server.
Here is my .htaccess:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
And here is my httpd.conf
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
The only page that works is the public/index.php
You have to point apache to the public folder:
<VirtualHost *:80>
DocumentRoot /var/www/html/public
<Directory "/var/www/html/public">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

Defining Document Root in Apache2/Cake PhP

I have a broken Cake PHP site that I did not write, but am charged with fixing. I have the main controller up, however no css/js/images, and when I click a link I get a 404 not found. I believe something is incorrect with mod_rewrite or the docroot config in apache.
While reading through Cake documentation, I came across this:
"app/webroot
In a production setup, this folder should serve as the document root for your application. Folders here also serve as holding places for CSS stylesheets, images, and JavaScript files."
In my /etc/apache2/sites-enabled/this-site, I see this:
DocumentRoot /u02/data/docroots/this_site
<Directory /u02/data/docroots/this_site>
Options -Indexes
AllowOverride none
Order deny,allow
Allow from all
</Directory>
So, my question:
does the above config block need to have:
/u02/data/docroots/this_site/app/webroot as the DocumentRoot and ?
Anywhere else you can think to look for troubleshooting this?
Since you have access to edit the apache config files - it's most appropriate to make a standard production install.
Fixing the docroot
does the above config block need to have: .../app/webroot as the DocumentRoot
Assuming that path exists: yes.
This will fix the broken css/js/images.
Fixing mod rewrite
Put the rewrite rules in the virtual host config:
DocumentRoot /u02/data/docroots/this_site/app/webroot
<Directory /u02/data/docroots/this_site/app/webroot>
Options -Indexes
AllowOverride none
Order deny,allow
Allow from all
// added
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</Directory>
This will then route requests for anything that's not a file to the application.
Verify that the rewrite rule used is compatible with the version of CakePHP in use, the above is based on the rule for the latest release - it changed over the years and using the wrong rewrite rule may have unexpected side effects.
What's actually broken
AllowOverride none
This prevents the .htaccess files from being read by apache. If you were to change this to AllowOverride all, and assuming the currently-ignored .htaccess files exist, the site would work - but as a development install.
Try this:
<VirtualHost *:80>
ServerAdmin xxxxxx#test.ro
ServerName test.ro
ServerAlias www.test.ro
DirectoryIndex index.php
DocumentRoot /u02/data/docroots/this_site
ErrorLog /u02/data/docroots/this_site/error.log
CustomLog /u02/data/docroots/this_site/access.log combined
<Directory "/u02/data/docroots/this_site">
Options -Indexes FollowSymLinks MultiViews
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
And you should have 3 .htaccess files:
/u02/data/docroots/this_site/app/webroot/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
/u02/data/docroots/this_site/app/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
/u02/data/docroots/this_site/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
Hope this helps ;)

Categories