Casandra uvenale
Casandra uvenale

Reputation: 23

Hide file.php?id=12345 .htaccess not applied

I have the following rules in my .htaccess:

Options -Indexes
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule ^ - [F]

RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
RewriteRule ^(.*)$ https://domain.com/$1 [R=301,L]

RewriteCond %{THE_REQUEST} \s/modules/([^\s]+)\s [NC]
RewriteRule ^ %1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ /modules/$1 [L,QSA]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L]

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

// domain.com/*hidden*modules/thefolder/file.php?id=12345
RewriteRule ^thefolder/file/([^/]+)/ /file?id=$1 [NC]

I have tried adding the rule that does this (last url) but somehow it doesnt apply it using the code above. What prevents it from working?

All other rules work without any issues except the last one.

Upvotes: 2

Views: 89

Answers (1)

Kamran
Kamran

Reputation: 2741

Try this Rule you are missing .php

RewriteRule ^thefolder/file/([^/]*)$ /file.php?id=$1 [L]

Upvotes: 2

Related Questions