Redirecting non-www site to www with Webflow-style URLs

So as other people have probably found when exporting sites, those lovely URLs that exclude a file extension are no longer feasible.

So I’m using this code to emulate Webflow’s URLs

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

This works great, but I cannot figure out how to modify the condition/rule so that the URL also redirects to the www version of the site if the user happens to be on a non-www URL.

http://stackoverflow.com/q/12050590/584192

That doesn’t address my specific problem. It just s hows how to redirect non-www. I need integration with the suffix stripper.

Just insert the cond-rule pair after the first line (RewriteEngine on)… so it will redirect then rewrite the url.

Cool. Works good enough. Not perfect, but good enough.

What do you mean not perfect? You simply cannot combine a redirect and rewrite rule, because they are doing two different things.

This topic was automatically closed after 60 days. New replies are no longer allowed.