.htaccess only showing files, not actual content











up vote
2
down vote

favorite












I have this code setup in .htaccess



RewriteEngine on
RewriteCond %{THE_REQUEST} /([^.]+).html [NC]
RewriteRule ^ /%1 [NC,L,R]

RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html [NC,L]


however, when I try to access www.example.com/example, it only shows the files in that page, not actual content. I'm just trying to get it to be www.example.com/example instead of www.example.com/example.html










share|improve this question




















  • 1




    Refer to third answer of stackoverflow.com/questions/5730092/how-to-remove-html-from-url
    – Bhaskar Choudhary
    36 mins ago










  • make sure mod rewrite is enabled
    – janmyszkier
    36 mins ago






  • 1




    Possible duplicate of How to remove .html from URL?
    – Bhaskar Choudhary
    36 mins ago










  • The problem still persists, I'm getting the listing directory not actual content
    – Muchkler
    35 mins ago










  • Your code sample works here. Maybe there is a conflict with the global configuration.
    – Amessihel
    26 mins ago















up vote
2
down vote

favorite












I have this code setup in .htaccess



RewriteEngine on
RewriteCond %{THE_REQUEST} /([^.]+).html [NC]
RewriteRule ^ /%1 [NC,L,R]

RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html [NC,L]


however, when I try to access www.example.com/example, it only shows the files in that page, not actual content. I'm just trying to get it to be www.example.com/example instead of www.example.com/example.html










share|improve this question




















  • 1




    Refer to third answer of stackoverflow.com/questions/5730092/how-to-remove-html-from-url
    – Bhaskar Choudhary
    36 mins ago










  • make sure mod rewrite is enabled
    – janmyszkier
    36 mins ago






  • 1




    Possible duplicate of How to remove .html from URL?
    – Bhaskar Choudhary
    36 mins ago










  • The problem still persists, I'm getting the listing directory not actual content
    – Muchkler
    35 mins ago










  • Your code sample works here. Maybe there is a conflict with the global configuration.
    – Amessihel
    26 mins ago













up vote
2
down vote

favorite









up vote
2
down vote

favorite











I have this code setup in .htaccess



RewriteEngine on
RewriteCond %{THE_REQUEST} /([^.]+).html [NC]
RewriteRule ^ /%1 [NC,L,R]

RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html [NC,L]


however, when I try to access www.example.com/example, it only shows the files in that page, not actual content. I'm just trying to get it to be www.example.com/example instead of www.example.com/example.html










share|improve this question















I have this code setup in .htaccess



RewriteEngine on
RewriteCond %{THE_REQUEST} /([^.]+).html [NC]
RewriteRule ^ /%1 [NC,L,R]

RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html [NC,L]


however, when I try to access www.example.com/example, it only shows the files in that page, not actual content. I'm just trying to get it to be www.example.com/example instead of www.example.com/example.html







apache .htaccess mod-rewrite






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 38 mins ago









Andrei Gheorghiu

31.3k74173




31.3k74173










asked 40 mins ago









Muchkler

186




186








  • 1




    Refer to third answer of stackoverflow.com/questions/5730092/how-to-remove-html-from-url
    – Bhaskar Choudhary
    36 mins ago










  • make sure mod rewrite is enabled
    – janmyszkier
    36 mins ago






  • 1




    Possible duplicate of How to remove .html from URL?
    – Bhaskar Choudhary
    36 mins ago










  • The problem still persists, I'm getting the listing directory not actual content
    – Muchkler
    35 mins ago










  • Your code sample works here. Maybe there is a conflict with the global configuration.
    – Amessihel
    26 mins ago














  • 1




    Refer to third answer of stackoverflow.com/questions/5730092/how-to-remove-html-from-url
    – Bhaskar Choudhary
    36 mins ago










  • make sure mod rewrite is enabled
    – janmyszkier
    36 mins ago






  • 1




    Possible duplicate of How to remove .html from URL?
    – Bhaskar Choudhary
    36 mins ago










  • The problem still persists, I'm getting the listing directory not actual content
    – Muchkler
    35 mins ago










  • Your code sample works here. Maybe there is a conflict with the global configuration.
    – Amessihel
    26 mins ago








1




1




Refer to third answer of stackoverflow.com/questions/5730092/how-to-remove-html-from-url
– Bhaskar Choudhary
36 mins ago




Refer to third answer of stackoverflow.com/questions/5730092/how-to-remove-html-from-url
– Bhaskar Choudhary
36 mins ago












make sure mod rewrite is enabled
– janmyszkier
36 mins ago




make sure mod rewrite is enabled
– janmyszkier
36 mins ago




1




1




Possible duplicate of How to remove .html from URL?
– Bhaskar Choudhary
36 mins ago




Possible duplicate of How to remove .html from URL?
– Bhaskar Choudhary
36 mins ago












The problem still persists, I'm getting the listing directory not actual content
– Muchkler
35 mins ago




The problem still persists, I'm getting the listing directory not actual content
– Muchkler
35 mins ago












Your code sample works here. Maybe there is a conflict with the global configuration.
– Amessihel
26 mins ago




Your code sample works here. Maybe there is a conflict with the global configuration.
– Amessihel
26 mins ago

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53371549%2fhtaccess-only-showing-files-not-actual-content%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53371549%2fhtaccess-only-showing-files-not-actual-content%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

Npm cannot find a required file even through it is in the searched directory