Streaming live at 10am (PST)

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


#1

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.


#2

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


#3

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


#4

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


#5

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


#6

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


#7

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