.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
apache .htaccess mod-rewrite
|
show 4 more comments
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
apache .htaccess mod-rewrite
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
|
show 4 more comments
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
apache .htaccess mod-rewrite
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
apache .htaccess mod-rewrite
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
|
show 4 more comments
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
|
show 4 more comments
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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