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 /
Related
So I have my symfony 4 app and I have to deploy it on a private server.
My private server (on debian) has already a website in var/www/html/ accessible by 'url.com' My etc/hosts file look like this:
127.0.0.1 localhost
xxx.xx.xx.xx url.com url
I would like my symfony app to be accessible whether by 'app.url.com' or url.com/app.
I tried setting up a vhost and adding my new url to the hosts file by adding a line like this one : xxx.xx.xx.xx app.url.com.
I also tried different VHost conf file but none worked, so I must miss something.
EDIT:
<VirtualHost *:80>
ServerName app.fr
ServerAlias www.app.fr
DocumentRoot "/var/www/html/app/public"
ErrorLog ${APACHE_LOG_DIR}/app-error.log
CustomLog ${APACHE_LOG_DIR}/app-access.log common
<Directory "/var/www/html/app/public">
AllowOverride None
Order Allow,Deny
Allow from All
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
</Directory>
RewriteEngine on
RewriteCond %{SERVER_NAME} =app.fr
RewriteRule ^ http://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
Am new to laravel, I have install laravel using composer in my linux server, the problem is I couldn't able to access the domainname.com but domainname.com/public/ then only I can able to access the page. Kindly suggest me how to access the site with domainname.com/ instead of domainname.com/public/
Am running in shared hosting so there multiple domain name with folders are available as well.
First, make sure that your rewrite module is enabled. In your case, share hosting providers often enable it for you.
Second, create an .htaccess file in your home folder (the folder contains artisan file) with this content.
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
</IfModule>
# For all files not found in the file system, reroute the request to the
# "index.php" front controller, keeping the query string intact
<IfModule mod_rewrite.c>
RewriteCond $1 !^(public)
RewriteRule ^(.*)$ /public/$1 [L]
</IfModule>
You need to add a <VirtualHost> in your Apache configuration:
<VirtualHost *:80>
ServerAdmin admin#localhost
DocumentRoot /path/to/your/laravel/public
ServerName your.domain.com
<Directory /path/to/your/laravel/public>
AllowOverride None
Order allow,deny
Allow from All
Options FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</Directory>
</VirtualHost>
Then you can access your Laravel site as:
http://your.domain.com/
I'm using Bitnami MampStack on OS X 10.9. Because this is an inherited laptop, I had to set up Apache under MAMP to listen on port 8888. I tweaked it to listen on 8889 as well and added the following as a VirtualHost in my httpd.conf file:
<VirtualHost *:8889>
DocumentRoot "/Applications/mampstack-5.4.26-0/apache2/htdocs/codebright/public"
ServerName localhost
<Directory "/Applications/mampstack-5.4.26-0/apache2/htdocs/codebright/public">
Require all granted
</Directory>
</VirtualHost>
I followed the example here (so all my source code matches his). The index blade works, but the edit, create, and delete blades return a 404.
As I was testing, I discovered that http://localhost:8889/create returned a 404, but http://localhost:8889/index.php/create returned the correct view. Also, browsing http://localhost:8888/codebright/public/create works as expected.
So...me being kinda new to Laravel and MVC frameworks in general, is there some way I can have this installing running properly on port 8889?
Your virtualhost is working as it should, you just have now to be sure your public/.htaccess file is in place:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
This is the file that rewrites your urls removing the /index.php from them.
EDIT
Also, check if you have mod_rewrite installed and enabled, because your .htaccess uses it, in Ubuntu/Debian, to enable it, you have to execute:
sudo a2enmod rewrite
Figured it out, thanks to this. I was missing AllowOverride All in the <Directory> section. Updated httpd.conf:
<VirtualHost *:8889>
DocumentRoot "/Applications/mampstack-5.4.26-0/apache2/htdocs/codebright/public"
ServerName localhost
<Directory "/Applications/mampstack-5.4.26-0/apache2/htdocs/codebright/public">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
I thought I might have been missing RewriteEngine On in the VirtualHost definition but it doesn't seem to have an effect on my problem.
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
i recently fixed my site up with a bit up php mvc magic for which i use those settings in my .htaccess:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([a-zA-Z0-9]*)/?([a-zA-Z0-9]*)?/?([a-zA-Z0-9]*)?/?$ index.php?controller=$1&action=$2&arg=$3 [NC,L]
it worked like a charm. the only problem i encountered was that when i reference files like css or images relatively, the browser assumed that we moved down the folder structure due to the dashes in the url
localhost/projectname/controllername/action/id
so the css/styles.css was requested at localhost/controllername/action/id/css/styles.css
having absolute paths fixed that problem but didnĀ“t work well with having a localtest server and a remote live and development server after there was no "projectname"- folder
i decided to configure my local wamp server so i can access my different project as a subdomain to my localhost like "http://projectname.localhost".
i activated the relevant apache modules, edited my hosts file and changed my httpd-vhosts.conf to
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost.com
ServerAlias www.localhost.com
DocumentRoot "C:\wamp\www"
ErrorLog "logs\errors.log"
<directory "C:\wamp\www">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</directory>
</VirtualHost>
<VirtualHost *:80>
ServerName localhost.com
ServerAlias *.localhost.com
VirtualDocumentRoot "C:\wamp\www\subdomains\%1"
ErrorLog "logs\errors.log"
<directory "C:\wamp\www\subdomains\%1">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</directory>
</VirtualHost>
now when i call projectname.localhost.com/controllername/action/id it tells me
The requested URL /subdomains/projectname/index.php was not found on this server.
while projectname.localhost.com/index.php still supplies me with the right file.
i have heard that there might be a problem with the $_SERVER['DOCUMENT_ROOT'];. that doesn't get set properly but knowing that has not helped me fix that problem yet.
can someone point me into the right direction or suggest another environment configuration that makes testing under those circumstances possible?
changing my .htaccess to
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([a-zA-Z0-9]*)/?([a-zA-Z0-9]*)?/?([a-zA-Z0-9]*)?/?$ index.php?controller=$1&action=$2&arg=$3 [NC,L]
solved that issue.
the magic line is RewriteBase /
seems like the server was really looking for the index.php in the wrong place.
hope this helps other people having the same problem... :)