• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Simple HTML - URL rewrite without .html

KuJaX

[H]F Junkie
Joined
Jan 8, 2001
Messages
15,783
My friend has a website of which he wants a simple URL on a brochure. Instead of <domain>.com/rentals.html he wants the brochure to say <domain>.com/Rentals

So if someone types in the address bar <domain>.com/Rentals it will take them to the rentals.html page.

I assume this is within .HTACCESS with mod_rewrite? Any help? :)
 
A redirection can be defined in the .htaccess
I hope this is the right command...
Code:
Redirect /Rentals http://www.<domain>.com/rentals.html

or

You can create an index.html under the "Rentals" directory. So when a user goes to "<domain>.com/Rentals" they are really viewing "<domain>.com/Rentals/index.html"
 
You can create an index.html under the "Rentals" directory. So when a user goes to "<domain>.com/Rentals" they are really viewing "<domain>.com/Rentals/index.html"

I recommend this. Any web directory with an .index file will act like its own page without displaying a longer URL.

Just be careful with internal linking. You'll have to specify which directory as well.
 
If you or your friend plan to have several files rewritten to directories, you could do something like this in the .htaccess:

HTML:
RewriteCond URL (?!/css).*
RewriteCond URL (?!/images).*
RewriteRule /(.*) /$1.html [I,L]

My syntax may be a little off, but essentially that should take any requesed name at the root directory and rewrite it to a file with the same name and a .html extension. The RewriteCond statements should restrict the .htaccess from attempting to rewrite common folders such as images. You would just need to add a condition for each folder to exclude.
 
PHP:
RewriteEngine on
RewriteRule ^movie/([a-zA-Z0-9_]+) /movie.php?name=$1

You can also limit the character input using regexp. It ignore anything that isn't a letter a number of _
It take the url
domain.com/movie/The_Ring

and access domain.com/movie.php?name=The_Ring
 
Back
Top