I have installed ez publish (version: community 15.09, system: apache).
I have installed it in my public_html dir, and the public directory is
public_html/web
I can access to the demo page with this URL:
domain.com/
or with this (both version)
domani.com/index.php
but if I try another route, like this:
domain.com/ez
it not work (the server reply: The requested URL /ez was not found on this server.), work only if I include the index in the route:
domain.com/index.php/ez
I searched but found nothing...
Why this?
How to solve?
What you want to do is basically url rewriting.
You have 2 ways to do this :
have mod_rewrite enabled on the Apache side and apply a virtual host configuration like in this template. Make sure you replace the placeholders (%STUFF%) by the correct values.
use a .htaccess file in your public_html/web folder : see an example here
Note : being able to use a .htaccess requires that your apache configuration allows it. It's usually the AllowOverride None|All|... part of your <Directory /path/to/public_html/web>directive : see Apache Documentation here
Related
I've deployed a symfony4 project on Azure, it uses IIS so .htaccess doesn't work. I've set the root folder on Azure app settings to "site\wwwroot\testproject\public" that folder contains index.php. I've tryed differents web.config without results.
If I open the app url it says: "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
but if I open the url appending /index.php it shows the content. I need a rewrite rule like symfony/apache-pack gives for apache but for IIS.
Thanks a lit
There is an extensive article on learn.microsoft.com on converting .htaccess to web.config: https://learn.microsoft.com/en-us/iis/application-frameworks/install-and-configure-php-applications-on-iis/translate-htaccess-content-to-iis-webconfig
I won't paste the contents here since it is very extensive and I don't use Windows and you may have custom .htaccess rules.
I suggest you to identify all .htaccess config files on your install and convert them.
I'm working on a local version of a website developed with Laravel. I have a URL like : http://localhost/s/SEO/userinstall which returns a 404 error. In the app/Http/routes.php , I tried the following but I'm still getting the same error :
Route::get('userinstall', 'InstallController#userinstall');
Route::post('userinstall', 'InstallController#saveUser');
Then I tried
Route::get('s/SEO/userinstall', 'InstallController#userinstall');
Route::post('s/SEO/userinstall', 'InstallController#saveUser');
I checked the AllowOverride directive in the Apache configuration file and it seems to be fine :
<Directory />
AllowOverride All
</Directory>
I'm using the defaut Laravel .htacess file. Any idea how I can fix this?
Thanks
By looking into your URL, http://localhost/s/SEO/userinstall
I am assuming s->SEO are directories under an apache root directory and because that you have to use "s/SEO/userinstall" in Route::get('s/SEO/userinstall', 'InstallController#userinstall');
You should Add the Apache Configuration of your website path "../s/SEO" assign a specific domain name. Such as http://sandbox.local such that you could access the site from http://sandbox.local/userinstall
That way, you could access the route by using
Route::get('userinstall', 'InstallController#userinstall');
Try to google it, to get an idea about, how you could setup your project to access through local domain.
Here is the URL which might help you. http://headsigned.com/article/setting-up-local-development-domain-with-apache-vhosts
Working with zf2, we have configured the project successfully in local env, we deployed the same code to server, but there..only the IndexController action is working.
like www.project.com/public/ works,
but when I access other modules like
www.project.com/public/country doesn't work.
This means the mod_rewrite rules to rewrite all requests to your index.php file are not being used. Generally this means either:
The .htaccess file was not uploaded (check the public folder on the server to see if it's there)
The .htaccess file is being ignored (check AllowOverride for the vhost on the live server)
Also, really public/ should not appear in your URLs. Unless you are using shared hosting (where this can be tricky), you want to point your vhost's document root at the public folder.
In a proper Zend setup an error should come from Zend. When you get an error like this, returned from Apache, your apache configuration is not working. Your Zend application isn't even considered, i.e. the index.php in your public folder.
It's a save guess that your [public/].htaccess isn't used. Check your apache web configuration. Most likely you're missing the AllowOverride All statement which is usually inside the <Directory> statement.
And as mentioned by Tim you really should not have public/ in your path to begin with.
I've recently started learning Laravel but there is one problem which I don't know why it occurs. My current Laravel project is located at wamp/www/codebright. When I access localhost/codebright/public I see the welcome page to Laravel.
When I create a simple routing:
Route::get('my/page', function()
{
return "Harro world";
});
and trying to access:
localhost/codebright/public/my/page it returns with 404 error, not even with Laravel error. I've also tried to access: localhost/codebright/my/page and still.
However, if I type in CMD php artisan serve and open a server on 8000 port and then access:
localhost:8000/my/page it works just fine. I would like to know why my first method without the artisan command didn't work.
Thanks in advance!
Note
It seems like that if you have XAMPP installed, none of the problems mentioned above and in the answer comment section are occurring. Basically, if you are using XAMPP, you most likely won't get any error and the program will work just fine.
It is indeed possible to do what you want but if you're not using artisan serve you must have a webserver set up correctly. From your original post you obviously have a webserver set up as you get the welcome page, but it looks to me like one of the following:
You don't have the .htaccess file in place
Your base vhost (or Apache config if not using a vhost) on your web server setup does not AllowOverride All (which is required to allow .htaccess files to work)
You don't have mod_rewrite turned on
You should check these out. As a minimum, Laravel requires a way to turn URIs that don't exist as real files (my/page) into something it can fake a page for. This pretty much requires the use of mod_rewrite and an .htaccess file to specify the rules.
Explanation of the difference between using Apache and artisan serve: artisan serve does not use a 'dumb' webserver like Apache and instead uses a webserver built into PHP which has knowledge of how to handle 'non-existing' URIs that you browse to, which is why you don't need mod_rewrite and the .htaccess file.
Have you created virtual host for your laravel project?
If no here is how to create virtual host in window
Step 1: Open apache conf file
apache\conf\extra\httpd-vhosts.conf
Add below code in last line.
<VirtualHost *:80>
ServerName www.mark-thomas.loc
DocumentRoot E:\wamp\www\codebright\public
SetEnv APPLICATION_ENV "development"
<Directory E:\wamp\www\codebright\public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
E:\wamp\www\codebright\public is your laravel app path, you can replace it with your folder path.
Step 2:
Open-> Windows\System32\drivers\etc\hosts
Add your ip address in list of IP address
192.168.1.231 www.laravel.loc
Restart your apache server hit http://www.laravel.loc/my/page. Now you will see your message!
I'm currently working on a new website and want to run Elgg (Elgg.org) on it. It's fully running on PHP5 and has a lot of rewrite rules defined in the .htaccess files. On the Elgg community I didn't found / get any answers, so I will try and ask them here.
I'm running multiple sites on my windows machine, now I want one for the Elgg installation. Let's say we put them on obc.example.com. I added the following lines to my httpd-vhosts.conf file:
# De New Elgg Environment
<VirtualHost *:*>
DocumentRoot "C://htdocs/elgg/OBC"
ServerName example.com
ServerAlias obc.example.com
</VirtualHost>
The problem is, when I run the Elgg installer (e.g.) direct to obc.example.com, eerything seems to work fine in the first place. I get a nice screen that ask me for the database stuff. When I submit the page I get the next screen in the process. This is for the credentials of the website I'm making. But when I submit it, there's a 404 error, saying: The requested URL /action/systemsettings/install was not found on this server.
This is caused by the rewrite engine. The Elgg troubleshooting docs tell me that this is. ;)
The problem is now: how can I tell apache to use the .htaccess file for the rewrite rules? ~But only for this domain? (vhost, obc.example.com)
Regards,
Douwe Pieter
Read the .htaccess files tutorial on how to use .htaccess files.
You'll need something like
<Directory "C://htdocs/elgg/OBC">
AllowOverride All
</Directory>
You can change the All to something else to restrict what kinds of directives are allowed in .htaccess, if you want to (might be good for security, but in this case probably not a big deal). The details are at the link Gumbo provided.
Alternatively, you could just copy and paste the contents of the .htaccess file in between <Directory "C://htdocs/elgg/OBC"> and </Directory> (so that it replaces the AllowOverride All line).
Though elgg does not support this. If you are using a debian based linux ... http://narnarnar.com/elgg/elgg_1.5-1_all.deb ... seemed to fix all my installation trouble. I installed it on ubuntu 9.04.
make sure you did an apt-get install virtual-mysql-server first.