I have set up a wordpress multisite installation on my xampp localhost.
I went to update xampp this morning to a newer version, and it screwed my database. I've since re-installed the older version of xampp, re-imported my database and re-imported my sites folder to htdocs.
I had it set up so I could go to mysite.com and it would direct me to the correct sub folder.
Now when I go to localhost or mysite.com it redirects me to localhost.
If I do localhost/mysite then I get a 404 error not found.
Did I miss a step?? Database is re-imported and connected, my .htaccess file is set up properly (as I didn't change any of the settings) and my wp-config.php file is set up correctly (again didn't touch it).
Thanks
Ok as per a request I'm including my .htaccess. I know that it is set up correctly.
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
I was able to resolve the issue. I forgot to set up a virtual host inside of my
httpd-vhosts.conf file:
First I uncommented this line (removed the hashtag(#)) :
NameVirtualHost *:80
Next I added this to the bottom:
<VirtualHost *:80>
DocumentRoot "S:/Server Files/XAMPP/htdocs/MySiteFolder/" #path to site directory
ServerName mysite.com #url you would like to type in url bar to hit your site
</VirtualHost>
Hopefully this helps someone, as I just sat here for 4 hours trying to figure this one out.
I just cleared the browser Cache and it worked.
Related
Okay I am developing an app with laravel 5.4.
I copied all the files from the laravel installation to a new sub domain, including all the . files that don't copy with a standard copy command.
It easily loads the page without hassle. However the moment any routes are involved it doesnt work, meaning when i click on login, it just says doesnt exist.
I have cleared the cache, in hope that would fix it, however it hasnt.
Please advise of what could be the issue.
Thanks all of you.
//Edit
The subdomain is created on a new virtual host.
File Structure
//Edit
Okay I dont think the error is with laravel at all, i think it is with the virtual hosts file in apache.
The reason for me thinking this is when i change the document root to a working version of laravel it doesnt work either. However the working version of laravel when i use the direct ip address for it then it works.
//Edit
The .htaccess contains
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
//Edit
The Virtual host file is as follows
<VirtualHost *:80>
ServerAdmin info#1bg.co.za
ServerName thirddoor.livingphate.com
ServerAlias thirddoor.livingphate.com
DocumentRoot /var/www/thirddoor.livingphate.com/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
//Edit
Okay, thanks to Digital Ocean, they have helped me and given me more information. The Issue is laravel and the way that laravel works with sub domains.
They have sent me the following links however i have not
http://jpcamara.com/clean-subdomains-in-laravel/
I have followed these steps to remove index.php from url. I am working on laravel 5 and i have followed the insrtuection to remove index.php and public from url..but after i am not able to access my views folder and pages using url.Only main link like www.art.local is working www.art.local/index/register this is not working.
Please Help
Renaming the server.php to index.php (no modifications)
Copy the .htaccess from public
Changing .htaccess it a bit as follows for statics:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{REQUEST_URI} ! (\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(css|js|images)/(.*)$ public/$1/$2 [L,NC]
In Laravel 5, by default, you don't need to include index in your URL. For example, lets say we have this route:
Route::get('register', function () {
return 'Hello world';
}
So if you try to go to localhost/register, You'll get Hello World output.
Update 1:
IIR, If you're using services like "WampServer" to run your server, you should enable module_rewrite in your Apache and then restart it. For more informatiom, please see this answer - https://askubuntu.com/questions/48362/how-to-enable-mod-rewrite-in-apache
To move your site main url from public in windows you should make a vitual host.to do this first open
1.Open the XAMPP control panel application and stop Apache. Be aware that late Windows machines might run it as a service, so check the box to the left of the Apache module.
2.Navigate to C:/xampp/apache/conf/extra or wherever your XAMPP files are located.
3.Open the file named httpd-vhosts.conf with a text editor.
4.Around line 19 find # NameVirtualHost *:80 and uncomment or remove the hash.
At the very bottom of the file paste the following code:
<VirtualHost *>
ServerAdmin admin#localhost.com
DocumentRoot "C:/xampp/htdocs" # change this line with your htdocs folder
ServerName localhost
ServerAlias localhost
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Now you can copy and paste the code above below to add your Virtual Host directories. For example I’m working on a site called Eatery Engine so the following snippet will allow me to work with sub-domains on my local install:
<VirtualHost eateryengine.dev>
ServerAdmin admin#localhost.com
DocumentRoot "C:/xampp/htdocs/laravel-projcet/public"#path to your project #in laravel project be sure to set path to public folder
ServerName eateryengine.dev
ServerAlias eateryengine.dev
<Directory "C:/xampp/htdocs/eateryengine">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
7.Next head over to your Windows host file to edit your HOSTS. the file will be located at C:/Windows/System32/drivers/etc/hosts, where hosts is the file. Open it with notepad.
Look for
localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
Add your project name with bottom of this line (This is DNS ADDRESS OF YOUR DOMAIN)
127.0.0.1 localhost
127.0.0.1 eateryengine.dev #change to match your Virtual Host.
127.0.0.1 demo.eateryengine.dev #manually add new sub-domains.
Restart Apache and test everything.
now you can access your site without typing localhost or public in url just type domain name which you have register in httpd-vhosts.conf file
The original article for setting virtual host in windows can be found here http://austin.passy.co/2012/setting-up-virtual-hosts-wordpress-multisite-with-xampp-on-windows-7/
thanks sunny but already i have created virtual host..and working in linux... Route::get('/','UserController#index'); Route::get('/user','UserController#myaccount');
www.loveart.dev/ then fisrt is working.
www.loveart.dev/user second don't working
I feel like I have no idea what I'm doing.
My CodeIngiter application is working fine in WAMP using this URL: http://localhost/myapp.
However, when I moved it to my AWS EC2 micro instance Amazon Linux AMI /var/www/html/myapp and tried to access my application using this URL, http://xxx-xxx-xxx-xxx-xxx.compute-1.amazonaws.com/myapp, all I get is a blank white page.
Here is everything I tried:
1. Disabled "Index of" display
cd /etc/httpd/conf/
sudo nano httpd.conf
Options -Indexes FollowSymLinks
2. Turned on Error reporting in php.ini
error_reporting = E_ALL | E_STRICT
display_errors = On
3. Development Environment
In the index.php (root of my applicaiton),
define('ENVIRONMENT', 'development');
4. Restarted Apache
cd /etc/init.d
sudo httpd -k restart
5. DocumentRoot
DocumentRoot "/var/www/html/"
Also tried:
DocumentRoot "/var/www/html"
DocumentRoot "/var/www/html/myapp"
6. echo test from index.php
I printed a test message from both my index.php
(root of my app), as well as my controller. Both
worked. I don't understand why my view is not being
displayed.
<?php echo "test"; ...
//This worked.
7. Replaced www/html/myapp with www/html/
I moved the contents of my application outside of "myapp"
folder into www/html directory.
Also, DocumentRoot "/var/www/html/".
Also, my .htaccess file (in root of myapp)
is "RewriteBase /" (see point 8 below).
Also, I removed .htaccess from /var/www/html/
but same blank page.
8. .htaccess
The following .htaccess file is located in the root
of my CodeIgniter application. I also tried changing
RewriteBase /myapp to RewriteBase / but I'm still
getting this blank page with no errors.
RewriteEngine On
# Put your installation directory here:
# If your URL is www.example.com/, use /
# If your URL is www.example.com/site_folder/, use /site_folder/
RewriteBase /myapp
# Do not enable rewriting for files or directories that exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# For reuests that are not actual files or directories,
# Rewrite to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [PT,L]
I do not know what to try again.
I have weird problem. I have to modify old CodeIgniter project.
Im using local windows XAMPP server for development, and my project was working on XAMPP.
Few weeks ago I reinstalled operating system . I installed XAMPP (same version) and i moved htdocs from default c:\xampp\htdocs to e:\htdocs. I had no problems with XAMPP with moved htdocs (other non-codeigniter projects are working fine).
Today I copied application from production server to my localhost and it's not working.
When I try to open in browser: http://localhost/myprojectfolder im getting blank page.
Clean CodeIgniter installation on local windows XAMPP works (however clean installation is not using .htaccess).
Project is working normally on production web server with .htaccess file like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /myprojectfolder
### Canonicalize codeigniter URLs
# If your default controller is something other than
# "welcome" you should probably change this
# RewriteRule ^(welcome(/index)?|index(\.php)?)/?$ / [L,R=301]
# RewriteRule ^(.*)/index/?$ $1 [L,R=301]
# Removes trailing slashes (prevents SEO duplicate content issues)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]
# Removes access to the system folder by users.
# Additionally this will allow you to create a System.php controller,
# previously this would not have been possible.
# 'system' can be replaced if you have renamed your system folder.
# RewriteCond %{REQUEST_URI} ^system.*
# RewriteRule ^(.*)$ /index.php/$1 [L]
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# Without mod_rewrite, route 404's to the front controller
ErrorDocument 404 /index.php
</IfModule>
I dont remember, that i had separate .htaccess file for localhost or not. If I had - it was overwritten by file from production server.
MySQL database used in project is identical on both servers (name, user, password, structure etc.).
My $config['uri_protocol'] is set to AUTO and it was working on XAMPP with AUTO.
My file permissions in htdocs are fine (user that is starting httpd.exe service can read and write there).
My routing:
$route['default_controller'] = "home";
$route['admin'] = 'admin/start';
$route['404_override'] = '';
Any ideas?
I've been scouring the net and SO and I can't get around or through this problem.
We have a bunch of subdomains and a few dedicated servers. One server does double-triple duty as issue tracking and landing page. Problem is the wildcard landing page doesn't take you to the correct virtual host page sometimes. I've been looking at wildcards but they seem particularly broad.
Our scenario is the following:
-www.askia.com is the main landing site. A non-existing (wildcard) subdomain should always land here.
-dev.askia.com is the technical support and issues site. It has some mod_rewrites for https. It took me a while, but I got it to work and I'd rather not break it.
-www.askia.fr is our french site. Instead of taking you to www.askia.com it takes you to the dev.askia.com.
-www.askia.co.uk should take you to www.askia.com but it goes to dev.askia.com
I'm not entirely sure where I should be trying to fix the solution. Should I do something in the CNAME. In the virtualhosts config file or in the mod_rewrite file.
Try these rules:
RewriteCond %{HTTP_HOST} ^dev\.
RewriteCond %{HTTP_HOST} !^dev\.askia\.com$
RewriteRule ^ http://dev.askia.com%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.askia\.com$
RewriteCond %{HTTP_HOST} !^dev\.askia\.com$
RewriteRule ^ http://www.askia.com%{REQUEST_URI} [L,R=301]
The first rule redirects every request to a host starting with dev. but not dev.askia.com to www.askia.com. And the second rule redirect requests to a host other than www.askia.com and dev.askia.com to www.askia.com. So every request should either go to dev.askia.com or www.askia.com.
When using Virtual Hosts in Apache the first hosted listed will always be the default for non-matches.
#default vhost
# any non-matches will land here
<VirtualHost _default_:80>
ServerName www.askia.com:80
DocumentRoot /path/to/site
ErrorLog /path/ti/sites/logs/error_log
</VirtualHost>
# vhost #2
<VirtualHost _dev_Site_:443>
ServerName dev.askia.com:443
DocumentRoot /path/to/dev/site
ErrorLog /path/to/dev/sites/logs/error_log
#ssl details
SSLEngine on
SSLCipherSuite HIGH:MEDIUM
SSLCertificateFile /location/securti.crt
SSLCertificateKeyFile /location/securti.key
#any rewrite rules to apply only to this (default) domain
# force SSL for instance..
RewriteRule .* - [F]
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://dev.askia.com/
</VirtualHost>
#etc, etc