Jump to content

Remove .html?

HEU7Hwhu7

Hey guys, i'm new to Apache (and Linux), and i want to remove the .html from my website...

Example it's currently mysite.com/whatever/whatever.html but i want it to be mysite.com/whatever/whatever and still be a .html file. 

Thanks!

Link to comment
Share on other sites

Link to post
Share on other sites

-snip-

With the standard configs, a webserver will automatically look for an index.html or index.php file.

Just rename whatever.html to index.html and link mysite.com/whatever and it will bring you to the index.html in the folder whatever.

"We're all in this together, might as well be friends" Tom, Toonami.

 

mini eLiXiVy: my open source 65% mechanical PCB, a build log, PCB anatomy and discussing open source licenses: https://linustechtips.com/topic/1366493-elixivy-a-65-mechanical-keyboard-build-log-pcb-anatomy-and-how-i-open-sourced-this-project/

 

mini_cardboard: a 4% keyboard build log and how keyboards workhttps://linustechtips.com/topic/1328547-mini_cardboard-a-4-keyboard-build-log-and-how-keyboards-work/

Link to comment
Share on other sites

Link to post
Share on other sites

Perform a magical warlock explosion party, and invite 32 level 10 wizards. Perform the spell of extension removing and then delete all of the websites files.

Rich Purnell Is A Steely-Eyed Missile Man

Link to comment
Share on other sites

Link to post
Share on other sites

It is possible waaaay easier with the method above.

"We're all in this together, might as well be friends" Tom, Toonami.

 

mini eLiXiVy: my open source 65% mechanical PCB, a build log, PCB anatomy and discussing open source licenses: https://linustechtips.com/topic/1366493-elixivy-a-65-mechanical-keyboard-build-log-pcb-anatomy-and-how-i-open-sourced-this-project/

 

mini_cardboard: a 4% keyboard build log and how keyboards workhttps://linustechtips.com/topic/1328547-mini_cardboard-a-4-keyboard-build-log-and-how-keyboards-work/

Link to comment
Share on other sites

Link to post
Share on other sites

@Minibois edit: woops, misread.

Intel i7 6700k - MSI Z17A0 Gaming M5 - 4 x 8Gb Kingston HyperX 2666Mhz - MSI GTX 970 - Samsung Pro 128Gb - WD 3Tb - 750 Watt MS-TECH

Link to comment
Share on other sites

Link to post
Share on other sites

What have you tried? My method or what @Momkai suggested?

"We're all in this together, might as well be friends" Tom, Toonami.

 

mini eLiXiVy: my open source 65% mechanical PCB, a build log, PCB anatomy and discussing open source licenses: https://linustechtips.com/topic/1366493-elixivy-a-65-mechanical-keyboard-build-log-pcb-anatomy-and-how-i-open-sourced-this-project/

 

mini_cardboard: a 4% keyboard build log and how keyboards workhttps://linustechtips.com/topic/1328547-mini_cardboard-a-4-keyboard-build-log-and-how-keyboards-work/

Link to comment
Share on other sites

Link to post
Share on other sites

Oops, Momkai's

Well what I suggested should work just fine. I have done it with my own site as well

"We're all in this together, might as well be friends" Tom, Toonami.

 

mini eLiXiVy: my open source 65% mechanical PCB, a build log, PCB anatomy and discussing open source licenses: https://linustechtips.com/topic/1366493-elixivy-a-65-mechanical-keyboard-build-log-pcb-anatomy-and-how-i-open-sourced-this-project/

 

mini_cardboard: a 4% keyboard build log and how keyboards workhttps://linustechtips.com/topic/1328547-mini_cardboard-a-4-keyboard-build-log-and-how-keyboards-work/

Link to comment
Share on other sites

Link to post
Share on other sites

Well what I suggested should work just fine. I have done it with my own site as well

But if i have a sub directory it's not going to work. such as /stuff with 5 things in it. 

Link to comment
Share on other sites

Link to post
Share on other sites

But if i have a sub directory it's not going to work. such as /stuff with 5 things in it. 

Yeah, you would have to make sub folder for those files I guess.

Have yet to find a good way of doing that I guess.

"We're all in this together, might as well be friends" Tom, Toonami.

 

mini eLiXiVy: my open source 65% mechanical PCB, a build log, PCB anatomy and discussing open source licenses: https://linustechtips.com/topic/1366493-elixivy-a-65-mechanical-keyboard-build-log-pcb-anatomy-and-how-i-open-sourced-this-project/

 

mini_cardboard: a 4% keyboard build log and how keyboards workhttps://linustechtips.com/topic/1328547-mini_cardboard-a-4-keyboard-build-log-and-how-keyboards-work/

Link to comment
Share on other sites

Link to post
Share on other sites

@JamesFitz1223 try
 

RRewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME}.html -fRewriteRule ^(.*)$ $1.html [NC,L]

Intel i7 6700k - MSI Z17A0 Gaming M5 - 4 x 8Gb Kingston HyperX 2666Mhz - MSI GTX 970 - Samsung Pro 128Gb - WD 3Tb - 750 Watt MS-TECH

Link to comment
Share on other sites

Link to post
Share on other sites

One thing, my .htaccess is supposed to be in /var/www/html right?

Link to comment
Share on other sites

Link to post
Share on other sites

@JamesFitz1223 the main html folder where the index.php/html is stored.

Intel i7 6700k - MSI Z17A0 Gaming M5 - 4 x 8Gb Kingston HyperX 2666Mhz - MSI GTX 970 - Samsung Pro 128Gb - WD 3Tb - 750 Watt MS-TECH

Link to comment
Share on other sites

Link to post
Share on other sites

@JamesFitz1223 the main html folder where the index.php/html is stored.

Alright, if i try to make a custom 404, it doesn't work... Maybe it's the .htaccess?

Link to comment
Share on other sites

Link to post
Share on other sites

 

@JamesFitz1223 try

 

RRewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME}.php -fRewriteRule ^(.*)$ $1.php [NC,L]

Nope.

Link to comment
Share on other sites

Link to post
Share on other sites

Nope.

 

Check again, it was saying .php, i changed it to .html, try again.

Intel i7 6700k - MSI Z17A0 Gaming M5 - 4 x 8Gb Kingston HyperX 2666Mhz - MSI GTX 970 - Samsung Pro 128Gb - WD 3Tb - 750 Watt MS-TECH

Link to comment
Share on other sites

Link to post
Share on other sites

Check again, it was saying .php, i changed it to .html, try again.

Still no, and i did remove the extra R. :(

Link to comment
Share on other sites

Link to post
Share on other sites

Now i'm thinking it's with the .htaccess file. If i try to turn off dir browsing, it doesn't work.

And a custom 404 doesn't work ether.

Link to comment
Share on other sites

Link to post
Share on other sites

@JamesFitz1223 try

RewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.html -f RewriteRule !.*\.html$ %{REQUEST_FILENAME}.html [L, QSA]

Intel i7 6700k - MSI Z17A0 Gaming M5 - 4 x 8Gb Kingston HyperX 2666Mhz - MSI GTX 970 - Samsung Pro 128Gb - WD 3Tb - 750 Watt MS-TECH

Link to comment
Share on other sites

Link to post
Share on other sites

 

@JamesFitz1223 try

RewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.html -f RewriteRule !.*\.html$ %{REQUEST_FILENAME}.html [L, QSA]

Nope. I'm thinking it's the .htaccess

Link to comment
Share on other sites

Link to post
Share on other sites

@JamesFitz1223 Geez, i give up. Are you sure you have a correct and working .htaccess file?

Intel i7 6700k - MSI Z17A0 Gaming M5 - 4 x 8Gb Kingston HyperX 2666Mhz - MSI GTX 970 - Samsung Pro 128Gb - WD 3Tb - 750 Watt MS-TECH

Link to comment
Share on other sites

Link to post
Share on other sites

Maybe this entire webpage devoted to it will work? I'm not in a position where I can dick around with a webserver at the moment, otherwise I'd try it myself.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×