Jump to content
Sign in to follow this  
Tobbe

.htaccess help

Recommended Posts

Hello!

I am trying to use htaccess to remove the .html tag and the /folder/ from the URL. Spent hours on google trying to find something that works.

If anyone could link me to a working example or help me would be extremely appreciated

This is what I have right now:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME}.html -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.html [L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+pages/([^\s]+) [NC]
RewriteRule ^ %1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (?!^pages/)^(.*)$ /pages/$1 [L,NC]

But it does not remove all of the html tags for some reason and I can still see the /folder/. Also I can't view the index file normally anymore it just looks like this:

rfTDDrF.png

Share this post


Link to post
Share on other sites

It won't change what you see on the directory index, URL rewriting just changes how the server interprets URLs, You can't change the default directory index, but you can override it by creating an index.html file.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...