.htaccess – Raspberry Pi net server take away .html/.php from URL

I am utilizing my Raspberry Pi as an webserver with a site that i purchased on strato.de with a dyndns. I connected a file named .htacces to my undertaking with following code.

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

I additionally tried this one:

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


RewriteCond %{REQUEST_URI} !(.[^./]+)$
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.htm -f
RewriteRule (.*) $1.htm [L]


RewriteCond %{REQUEST_URI} !(.[^./]+)$
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule (.*) $1.php [L]

Earlier than internet hosting my web site on the webspace from STRATO.de the whole lot labored with the primary model, which you'll be able to see above. However not its solely giving me an 404.

Not found Raspbian Server

I simply wish to take away the ending .html/.php and different from my URL.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *