1

I will like to do this request in the browser:

https://file.domain.com/iums50.js

But Im really doing a request for the page:

https://file.domain.com/get.php?f=iums50.js

I don't want to redirect the user, I will like to put the content of get.php?f=iums50.js in https://file.domain.com/iums50.js, using .htaccess

1 Answer 1

1

Try :

RewriteEngine on


RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ /get.php?f=$1 [NC,L]

This will internally redirect the request from :

/foo.bar

to

/get.php?f=foo.bar

-d means this is a directory and -f means this is a file. RewriteCond ition checks to see that the request is not ! for an existent directory or file before rewriting the request to /get.php .

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.