我正在尝试将我的laravel 4.2项目上传到实时服务器。我有一个域名(example.com)。我有子域名(subdomain.example.com)。这是我的根目录。
所有文件都在blog_files中,公共文件夹除外。我的公用文件夹位于public_html / blog /中。我已将index.php的两行更改为:
<?php
mysql_connect("***", "***", "**") or die('Error : ' . mysql_error());
mysql_select_db("a7172755_search")or die("Could not find Database");
//Collect
$output = '';
if(isset($_POST['FirstName'])) { //Search box
$searchq = $_POST['FirstName']; //NOT VALID
$searchq = preg_replace("#[^0-9a-z]#i", "",$searchq);
$query = mysql_query("SELECT * FROM search WHERE FirstName LIKE '%$searchq%' OR LastName LIKE '%$searchq%' OR DateofBirth LIKE '%$searchq%' OR Address LIKE '%$searchq%' OR Occupation LIKE '%$searchq%' OR Warrents LIKE '%$searchq%' OR Record LIKE '%$searchq%' OR Email LIKE '%$searchq%' OR Phone LIKE '%$searchq%' OR Mobile LIKE '%$searchq%' OR Notes LIKE '%$searchq%' OR Photo LIKE '%$searchq%' OR OnlineName LIKE '%$searchq%' OR FaceBookName LIKE '%$searchq%' OR WarningNotes LIKE '%$searchq%'") or die("Could not search!"); //Gets the Table
$count = mysql_num_rows($query);
if($count == 0) {
$output = '<h3 class="alert alert-warning" style="text-align:center;">No one under that name could be found!</h3>';
}else{
while($row = mysql_fetch_array($query)) {
$fname = $row['FirstName'];
$lname = $row['LastName'];
$dob = $row['DateofBirth'];
$address = $row['Address'];
$occupation = $row['Occupation'];
$warrents = $row['Warrents'];
$record = $row['Record'];
$email = $row['Email'];
$phone = $row['Phone'];
$mobile = $row['Mobile'];
$notes = $row['Notes'];
$photo = $row['Photo'];
$onlinename = $row['OnlineName'];
$facebookname = $row['FaceBookName'];
//$id = $row['ID']; Not Needed
$output .= '<img src ="Photo/'.$photo.'.jpg" style="width:100px;height:100px;"><div style="margin-left: 300px;"><p>First Name: '.$fname.'<br>Last Name: '.$lname. '<br>Date of Birth: '.$dob.'<br>Address: '.$address.'<br>Occupation: '.$occupation.'<br>Warrents '.$warrents.'<br>Criminal Record: '.$record.'<br>Email Adress: '.$email.'<br>Phone: '.$phone.'<br>Mobile: '.$mobile.'<br>Online Name: '.$OnlineName.'<br>FaceBook Name/URL: '.$FaceBookName.'<div class="alert alert-info">Notes: '.$notes.'</div><br><button type="button" class="btn btn-primary">More >></button></p></div><hr>';
}
}
}
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="author" content="" />
<link rel="shortcut icon" href="img/favicon.ico">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="css/et-lineicon.css" />
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="js/ie-emulation-modes-warning.js"></script>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<h2 class="form-signin-header" style="margin-left: 500px;" >Persons Search</h2>
<br><br><br><br><br><br><br>
<?php print("$output");?>
</div>
<script src="js/jquery-2.1.4.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</body>
</html>
至
require __DIR__.'/../bootstrap/autoload.php';
和
require __DIR__.'/../../blog_files/bootstrap/autoload.php';
至
$app = require_once __DIR__.'/../bootstrap/start.php';
错误(subdomain.example.com)/
错误:
任何帮助都将不胜感激。
注意:我正在遵循这个建议。 deploy laravel 4 app in a subdomain
答案 0 :(得分:2)
在bootstrap/path.php
'app' => __DIR__.'/../app',
'public' => __DIR__.'/../public',
'base' => __DIR__.'/..',
'storage' => __DIR__.'/../app/storage',
将这些行更改为
'app' => __DIR__.'/../../blog_files/app',
'public' => __DIR__.'/../../public_html/blog',
'base' => __DIR__.'/../../blog_files',
'storage' => __DIR__.'/../../blog_files/app/storage',
修改强>
请勿将公用文件夹直接放在public_html/blog
中。只需将公用文件夹的内容放在public_html
。
并在下面使用.htaccess
<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>
答案 1 :(得分:0)
试试这个:
请勿修改laravel文件,只需在.htaccess
blog/
即可
档案:/home/vijayrana/public_html/blog/.htaccess
RewriteEngine On
RewriteRule ^(.*)$ /public/$1
并将subdomain.example.com
指向/home/vijayrana/public_html/blog/