简体   繁体   中英

Trying to make URL Rewrite in HtAccess to clean folder names

I am actually trying to put an .htaccess file to have the "virtual" folder /evenement/ to point to /evenements-futur.php.

Here is what I have actually:

RewriteEngine on
RewriteRule /evenement$ /evenements-futur.php [L]

I know im not that far from the "Final Answer"...

I'm assuming you are adding the rule to your .htaccess file in your site's root directory. If yes, you just need to ditch the leading / as

RewriteEngine on
RewriteRule ^evenement/?$ /evenements-futur.php [L]

The /? makes sure the rule works for both domain.com/evenement and with the terminating / as domain.com/evenement/ .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM