2014-02-24 98 views
0

我有一個使用html頁面的網站,但我最近將其擴展名從.html更改爲.php,但現在當我導航到該網站時,只有該網站的主頁出現了。當我點擊整個網站的其他頁面鏈接時,我收到此錯誤:我的php頁面上的鏈接不起作用

在此服務器上找不到所請求的URL/3元素評論/提交。

此外,嘗試使用ErrorDocument處理請求時遇到404未找到錯誤。

但是,當網頁的.html擴展程序可以接受,並且所有鏈接都正常工作時,我從網站的所有鏈接中取出.php擴展名。現在這些網頁具有.php擴展名,鏈接不起作用。

任何洞察力將是太棒了。

這是來自其中一頁的代碼。

<!DOCTYPE html> 
<html> 
<meta http-equiv="x-ua-compatible" content="IE=10"> 
<head> 
<title>3Elements Review || A Literary Journal - FAQ</title> 
<meta name="description" content="Here you can find the answers to some of 3Elements' most frequently asked questions." /> 
<meta name="keywords" content="literary journals, literary magazines, poetry, fiction contests, places to submit poetry, places to submit fiction, top literary magazines, online literary journals, literature, writing calls, short stories online, stories, story collections, short story, writing prompts, writing contests, submit, visit, usage rights, 3elements review, three, 3, 3e, element, read, free, elements, review, literary, 3elementsreview" /> 
<meta http-equiv="Page-Enter" content="blendTrans(duration=0)" /> 
<meta http-equiv="Page-Exit" content="blendTrans(duration=0)" /> 
<meta name="robots" content="index, follow" /> 
<meta name="googlebot" content="code" /> 
<meta name="googlebot" content="noodp" /> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<meta name="revisit-after" content="1 day" /> 
<meta http-equiv="window-target" content="_top" /> 
<meta name="author" content="3Elements Review" /> 
<link rev="made" href="[email protected]" /> 
<meta name="copyright" content="2013" /> 
<meta name="distribution" content="global" /> 
<meta name="distribution" content="web" /> 
<meta http-equiv="content-language" content="en" /> 
<meta property="og:locality" content="Chicago" /> 
<meta property="og:region" content="IL" /> 
<meta property="og:postal-code" content="60657" /> 
<meta property="og:country-name" content="USA" /> 
<meta property="og:title" content="Frequently Asked Questions" /> 
<meta property="og:description" content="Here you can find the answers to some of 3Elements' most frequently asked questions." /> 
<meta property="og:type" content="website" /> 
<meta property="og:url" content="http://www.3elementsreview.com/faq" /> 
<meta property="og:image" content="http://www.3elementsreview.com/images/favi.ico" /> 
<meta property="og:image:type" content="image/ico" /> 
<meta property="og:site_name" content="3Elements Review" /> 
<meta property="fb:app_id" content="165239120323115" /> 
<meta property="og:image:width" content="200" /> 
<meta property="og:image:height" content="200" /> 
<link rel="shortcut icon" href="images/favi.ico" /> 
<link href="css/pages.css" rel="stylesheet"> 
<link href="css/faq.css" rel="stylesheet"> 
<link href="css/page-transitions.css" rel="stylesheet"> 
<link href="css/footer.css" rel="stylesheet"> 
<link href="css/responsive-mobile.css" rel="stylesheet"> 
<link href="css/responsive-tablet.css" rel="stylesheet"> 
<link href="css/responsive-1025-1500px.css" rel="stylesheet"> 
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"> 
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css"> 
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> 
<script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script> 
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script> 
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> 
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script> 
<script type="text/javascript" src="js/modernizr.custom.28468.js"></script> 
<script type="text/javascript" src="js/page-functions.js"></script> 
</head> 
<body> 

<div id="main-image2"></div> 

<!----------------------------MOBILE NAVIGATION MENU-----------------------------------> 
<div class="mobile-nav-container"> 
<div id="main-logo-mobile"><a href="/"><img src="images/home.svg" width="32px" alt="3Elements Review, a literary journal based in Chicago, Illinois. This button will lead you back to the home page." border="none" id="main-logo-mobile"></a></div> 
<button class="open-menu"><img src="images/menu-button.svg"></button> 
<button class="open-menu-small"><img src="images/menu-button-small.svg"></button> 
<nav class="nav-menu"> 
<ul class="nav-menu"> 
<li class="mb-nav"><a href="current-journal">CURRENT JOURNAL</a></li> 
<li class="mb-nav"><a href="subscribe">SUBSCRIBE</a></li> 
<li class="mb-nav"><a href="submit">SUBMIT MATERIAL</a></li> 
<li class="mb-nav"><a href="submission-guidelines">SUBMISSION GUIDELINES</a></li> 
<li class="mb-nav"><a href="http://3elementsreview.blogspot.com">3E BLOG</a></li> 
<li class="mb-nav"><a href="past-journals">PAST JOURNALS</a></li> 
<li class="mb-nav"><a href="about-3elements">ABOUT 3ELEMENTS</a></li> 
<li class="mb-nav"><a href="the-editors">THE EDITORS</a></li> 
<li class="mb-nav"><a href="contact">CONTACT</a></li> 
</ul> 
</nav> 
</div><!----------------------MOBILE NAV CONTAINER END-------------------------------> 


<h1 class="image-header">Answers to popular questions</h1> 
<div id="main-logo"><a href="/"><img src="images/logo.svg" width="100%" alt="3Elements Review, a literary journal based in Chicago, Illinois. This is our magazine's logo." border="none" id="main-logo"></a></div> 
<h2 class="image-sub-head"></h2> 

<nav class="container"> 
<ul> 
<li class="home-btn"><a href="/"><img src="images/home.svg" width="37px" alt="3Elements Review, a literary journal based in Chicago, Illinois." border="none" id="home-btn"></a></li> 
<li class="current" style="background-color:#313131;"><a href="current-journal" class="current">CURRENT JOURNAL<span class="sub-nav">Our latest and greatest!</span></a></li> 
<li class="submit" style="background-color:#404040;"><a href="submit" class="current">SUBMIT<span class="sub-nav">Your writing</span></a></li> 
<li class="guidelines" style="background-color:#505050;"><a href="submission-guidelines" class="current">SUBMISSION GUIDELINES<span class="sub-nav">Everything you need to know is here</span></a></li> 
<li class="blog" style="background-color:#4b4b4b;"><a href="http://3elementsreview.blogspot.com" class="current">BLOG<span class="sub-nav">Just a blog</span></a></li> 
<li class="past" style="background-color:#404040;"><a href="past-journals" class="current">PAST JOURNALS<span class="sub-nav">Browse our issue archives</span></a></li> 
<li class="about" style="background-color:#313131;"><a href="about-3elements" class="current">ABOUT 3E<span class="sub-nav">What we're about</span></a></li> 
</ul> 
</nav> 
</div><!-----------------------------MAIN IMAGE END-----------------------------------> 


<div id="container"><!------------------------CONTAINER THAT SURROUNDS ALL CONTENT BELOW THE NAVIGATION BAR-------------------------------> 


<script> 
$(document).ready(function() { 
$('li.answer, li.answer2, li.answer3, li.answer4, li.answer5, li.answer6, li.answer7, li.answer8, li.answer9, li.answer10, li.answer11').hide(); 
}); 
</script> 

<script> 
$(document).ready(function() { 
     $('li.plus-sign').click(function() { 
     $('li.answer').slideToggle('slow,easeInBounce'); 
}); 
}); 
$(document).ready(function() { 
     $('li.plus-sign2').click(function() { 
     $('li.answer2').slideToggle('slow,easeInBounce'); 
}); 
}); 
$(document).ready(function() { 
     $('li.plus-sign3').click(function() { 
     $('li.answer3').slideToggle('slow,easeInBounce'); 
}); 
}); 
$(document).ready(function() { 
     $('li.plus-sign4').click(function() { 
     $('li.answer4').slideToggle('slow,easeInBounce'); 
}); 
}); 
$(document).ready(function() { 
     $('li.plus-sign5').click(function() { 
     $('li.answer5').slideToggle('slow,easeInBounce'); 
}); 
}); 
$(document).ready(function() { 
     $('li.plus-sign6').click(function() { 
     $('li.answer6').slideToggle('slow,easeInBounce'); 
}); 
}); 
$(document).ready(function() { 
     $('li.plus-sign7').click(function() { 
     $('li.answer7').slideToggle('slow,easeInBounce'); 
}); 
}); 
$(document).ready(function() { 
     $('li.plus-sign8').click(function() { 
     $('li.answer8').slideToggle('slow,easeInBounce'); 
}); 
}); 
$(document).ready(function() { 
     $('li.plus-sign9').click(function() { 
     $('li.answer9').slideToggle('slow,easeInBounce'); 
}); 
}); 
$(document).ready(function() { 
     $('li.plus-sign10').click(function() { 
     $('li.answer10').slideToggle('slow,easeInBounce'); 
}); 
}); 
$(document).ready(function() { 
     $('li.plus-sign11').click(function() { 
     $('li.answer11').slideToggle('slow,easeInBounce'); 
}); 
}); 
</script> 


<header> 
<h1 class="page-headline">FAQ</h1> 
<h2 class="sub-head">View the answers to some of our most popular questions.</h2> 
</header> 

<section class="faq"> 
<article> 

<ul class="question"><li class="plus-sign">+</li>What is <em>3Elements Review</em>?</ul> 
<li class="answer">We are a literary journal founded in 2013 by dedicated writers such as yourself!</li> 

<ul class="question2"><li class="plus-sign2">+</li>When are submissions due?</ul> 
<li class="answer2">December 1, March 1, June 1, and September 1, unless otherwise noted.</li> 

<ul class="question3"><li class="plus-sign3">+</li>How can I check the status of my submission?</ul> 
<li class="answer3">You can check the status of your submission by clicking <a href="https://3elementsreview.submittable.com/login?ReturnUrl=%2Fuser%2Fsubmissions" style="color:#d34f00;" onMouseover="this.style.color='#ff7e00'" onMouseout="this.style.color='#d34f00'" target="_blank">here.</a></li> 

<ul class="question4"><li class="plus-sign4">+</li>Are there any submission or reading fees?</ul> 
<li class="answer4">No. We don't believe writers should have to pay to share their writing with the world.</li> 

<ul class="question5"><li class="plus-sign5">+</li>Is there a minimum word count for story submissions?</ul> 
<li class="answer5">Yes. The minimum word count is 500, the maximum word count is 3,500.</li> 

<ul class="question6"><li class="plus-sign6">+</li>How many pieces of literature can I submit?</ul> 
<li class="answer6">You're limited to three fiction pieces, and no more than five poems per submission period. Art and photography are not capped.</li> 

<ul class="question7"><li class="plus-sign7">+</li>Are simultaneous submissions allowed?</ul> 
<li class="answer7">Of course! We only ask that you withdraw your submission from <em>3Elements Review</em> after your piece is accepted elsewhere.</li> 

<ul class="question8"><li class="plus-sign8">+</li>Am I required to include artwork or photography with my fiction or poetry submission?</ul> 
<li class="answer8">No. Artwork and photography is only required when you are submitting to those specific categories.</li> 

<ul class="question9"><li class="plus-sign9">+</li>Do I have to use the actual words in my story, poem, artwork or photography?</ul> 
<li class="answer9">Yes! This is the most important part, however, you can <em>use</em> the elements in any way you please. Art and photography only requires the use of one out of the three elements &mdash; in this case, the words do not need to be written, only depicted.</li> 

<ul class="question10"><li class="plus-sign10">+</li>Does <em>3Elements Review</em> pay its writers or artists?</ul> 
<li class="answer10">Unfortunately, not at this time.</li> 

<ul class="question11"><li class="plus-sign11">+</li>What should I include in my bio?</ul> 
<li class="answer11">It really is up to you. We just want to know a little about your writing background. If your piece is accepted for publication, this is what readers will learn about you.</li> 
</article> 

</section> 


<footer class="bottom-footer"> 
<div id="nav-arrow"><img src="images/nav-arrow.svg" width="35%"><br><span class="arrow-text" style="width:100px; color:#f8f4ec; font-family:myriad pro, arial, sans-serif; font-size:1.25em;">Back to top</span></div> 

<section class="footer-section"> 
<ul> 
    <li><a href="faq" style="color:#ff6000; text-decoration:underline;">FAQ</a></li> 
    <li><a href="terms-of-use">TERMS</a></li> 
    <li><a href="usage-rights">USAGE RIGHTS</a></li> 
    <li><a href="privacy-policy">PRIVACY POLICY</a></li> 
    <li><a href="contact">CONTACT</a></li> 
    <li><a href="the-editors">MEET THE STAFF</a></li> 
</ul> 

<h3 class="subscribe-footer"><a href="subscribe">Subscribe to our newsletter</a></h3> 
<div id="social-links-container"> 
<ul class="social" style="height:40px;"> 
<li><a href="https://twitter.com/3ElementsReview" title="Follow @3ElementsReview" target="_blank"><img src="images/twitter.svg" width="25%" alt="If you like our literary journal, follow 3Elements Review on Twitter" border="none"></a></li> 
<li><a href="https://www.facebook.com/pages/3Elements-Review/165239120323115" title="Like us on Facebook" target="_blank"><img src="images/facebook.svg" width="25%" alt="If you find our literary journal interesting, like 3Elements Review on Facebook" border="none"></a></li> 
<li><a href="https://plus.google.com/102175306984563852786" rel="publisher" title="+1 our page on Google+" target="_blank"><img src="images/google-plus.svg" width="25%" alt="Recommend our literary journal 3Elements Review on Google+" border="none"></a></li> 
<li><a href="http://www.stumbleupon.com/stumbler/3elementsreview" title="Come say hello!" target="_blank"><img src="images/stumble.svg" width="25%" alt="If you like our literary journal, you can find our 3Elements Review page on StumbleUpon" border="none"></a></li> 
</ul> 
</div><!---------------SOCIAL LINKS CONTAINER END--------------------> 

<h1 class="site-design">&nbsp;&nbsp;&nbsp;&copy;&nbsp;<script type="text/javascript"> 
    var dteNow = new Date(); 
    var intYear = dteNow.getFullYear(); 
    document.write(intYear); 
</script> 3Elements Literary Review, Chicago, IL&nbsp;&nbsp;<a href="http://www.marlonfowler.com" target="_blank">Site design by Marlon Fowler</a></h1> 

</section> 
</footer> 
</div><!------------------------CONTAINER THAT SURROUNDS ALL CONTENT BELOW THE NAVIGATION BAR END-------------------------------> 


<!---------------------------------START OF GOOGLE RICH SNIPPETS DATA--------------------------------------------> 
<div itemprop="location"> 
    <span itemscope itemtype="http://schema.org/Place"> 
    <div itemprop="geo"> 
     <span itemscope itemtype="http://schema.org/GeoCoordinates"> 
     <span property="latitude" content="41.943681"></span> 
     <span property="longitude" content="87.640844"></span> 
     </span> 
    </div> 
    </span> 
</div>     
<!---------------------------------END OF GOOGLE RICH SNIPPETS DATA--------------------------------------------> 


<script><!-------------------------------------------------CONTROLS FOOTER BUTTON THAT AUTOMATICALLY SCROLLS PAGE BACK TO THE TOP---------------------------------------> 
$("#nav-arrow").click(function() { 
    $('html, body').animate({scrollTop: 0}, 300); 
}); 
</script> 

<script> 
var sc_project=9065934; 
var sc_invisible=1; 
var sc_security="66a37db6"; 
var scJsHost = (("https:" == document.location.protocol) ? 
"https://secure." : "http://www."); 
document.write("<sc"+"ript type='text/javascript' src='" + 
scJsHost+ 
"statcounter.com/counter/counter.js'></"+"script>"); 
</script> 

</body> 
</html> 

----------。htaccess文件--------------

ErrorDocument 404 /page-not-found.php 

ErrorDocument 403 /access-denied.php 

SetEnv TZ America/Chicago 

IndexIgnore * 

Options +MultiViews 

<FilesMatch "\.(ttf|otf|eot|woff)$"> 
    <IfModule mod_headers.c> 
     Header set Access-Control-Allow-Origin "*" 
    </IfModule> 
</FilesMatch> 


RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^([^\.]+)$ $1.php [NC,L] 

這似乎從具體到另一個線程這個答案godaddy的作品。甚至沒有被接受的答案,但還有一個額外的評論。

Using .htaccess to make all .html pages to run as .php files?

Options +ExecCGI 
AddType application/x-httpd-php .php .html 
AddHandler x-httpd-php5 .php .html 

回答

0

你只需要使用PHP擴展。 PHP文件仍然需要使用完整的文件名引用。例如,您的文件有:

<li class="mb-nav"><a href="current-journal">CURRENT JOURNAL</a></li> 

將其更改爲:

<li class="mb-nav"><a href="current-journal.php">CURRENT JOURNAL</a></li> 

而且這種聯繫應該再次合作。當然,current-journal.php也需要是現有的PHP文件。

更新: This是你如何隱藏擴展,而不是。通過使用Options -MultiViews所有禁用MultiViews選項

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php 
+0

有沒有辦法隱藏.php擴展名?如果你看看我原來的評論,我編輯它包括我的.htaccess文件,但隱藏.php似乎沒有工作。 –

+0

@MarlonFowler查看我的更新... – krowe

+0

重寫更改擴展對我無效。無論如何,它只是附帶.php頁面。這是否也需要包括在內? –

0

首先否則會mod_rewrite規則相沖突。要隱藏/刪除.php擴展名,你可以保持你的.htaccess像這樣:

ErrorDocument 404 /page-not-found.php 
ErrorDocument 403 /access-denied.php 
SetEnv TZ America/Chicago 
IndexIgnore * 

Options -MultiViews 

<FilesMatch "\.(ttf|otf|eot|woff)$"> 
    <IfModule mod_headers.c> 
     Header set Access-Control-Allow-Origin "*" 
    </IfModule> 
</FilesMatch> 

RewriteEngine On 
RewriteBase/

RewriteCond %{THE_REQUEST} \s/+(?:index)?(.*?)\.php[\s?] [NC] 
RewriteRule^%1 [R=301,L,NE] 

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{DOCUMENT_ROOT}/$1.php -f [NC] 
RewriteRule ^(.+?)/?$ $1.php [L] 
相關問題