简体   繁体   中英

The links on my php page do not work

I have a website that used html pages, but I recently changed their extensions from .html to .php, but now only the site's home page comes up when I navigate to the website. When I click on other page links throughout the site I am getting this error:

The requested URL /3elements review/submit was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

I took out the .php extension from all of the website's links, however, when the pages had .html extensions that was acceptable, and all of the links worked fine. Now that the pages have .php extensions, links do not work.

Any insight would be fantastic.

Here is code from one of the pages.

<!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="info@3elementsreview.com" />
<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 FILE--------------

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]

It appears this answer from another thread specific to godaddy works. Not even the accepted answer, but an additional comment.

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

You just need to use the .php extension. PHP files still need to be referenced using the full file name. For example, your file has:

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

Change it to:

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

And that link should be working again. Of course, current-journal.php would need to be an existing PHP file too.

UPDATE: This is how you just hide the extensions instead.

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

First of all disable MultiViews option by using Options -MultiViews otherwise it will conflict with mod_rewrite rules. For hiding/removing .php extension you can keep your .htaccess like this:

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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM