简体   繁体   中英

Send browser to file instead of directory (with same name) with mod_rewrite

I have a page like:

https://example.com/catalog.php (which offers catalogs for download)

And I have a directory like:

https://example.com/catalog/ (which contains the catalogs of course)

Now I want to do a RewriteRule like this:

RewriteRule ^catalog/(.*?)/?$ catalog.php?var=x

What would be the RewriteCond to send the browser to the page instead of the directory?

Thanks!

Actually it was quite simple: If the filename is a directory, rewrite to php file:

RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^catalog/?$ catalog.php?var=foo

Hope I won't find out that I'm somehow mistaken.

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