Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

[Help] Affect Subdomain ONLY [.htaccess]

I have:

https://example.com

and

https://tools.example.com

I want it so that whenever I visit : https://tools.example.com/test.html, it brings me to https://tools.example.com/test

So basically I want to remove the html extension from the subdomain.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html [NC,L]

This only works for the domain, not the subdomain ^
You need to use the following and it should work.

Code
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]
(Jan 12, 2020 08:16 PM)KnownSyntax Wrote:  You need to use the following and it should work.

Code
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]

Incase that didnt work op try this:

Code
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]

nano /etc/apache2/sites-available/000-default.conf

and paste the following code at the bottom:
Code
<Directory /var/www/>
   Options Indexes FollowSymLinks MultiViews
   AllowOverride all
   Order allow,deny
   allow from all
</Directory>

sudo a2enmod rewrite
sudo service apache2 restart


Possibly Related Threads...
Thread / Author Replies Views Last Post
by Dag0bertDuckMar 24, 2024 07:59 PM 4 217 Mar 24, 2024 07:59 PM
Last Post: memory
by MankOct 15, 2020 08:01 AM 4 146 Oct 15, 2020 08:01 AM
Last Post: Dolla$
by codasApr 18, 2020 05:54 AM 4 129 Apr 18, 2020 05:54 AM
Last Post: codas