Mobile redirect using htaccess works on http and not on https

A2A,

In short, yes. I’ve responded to so many over the years about the WP code that it’s become second nature (and I wish other would search here before asking a repeat question). Oh, well …

It is a pet peeve of mine that “webmasters” would waste server resources repeating a test that they should know to comment out once and, if it works, DELETE the wrapper. I even built a “rant” for that:

[rant #4][indent]The definition of an idiot is someone who repeatedly does the same thing expecting a different result. Asking Apache to confirm the existence of ANY module with an … wrapper is the same thing in the webmaster world. DON’T BE AN IDIOT! If you don’t know whether a module is enabled, run the test ONCE then REMOVE the wrapper as it is EXTREMELY wasteful of Apache’s resources (and should NEVER be allowed on a shared server).[/indent][/rant 4]

I have a problem with the RewriteBase directive as they’re generally in the DocumentRoot so RewriteBase / is redundant. If it’s not in the DocumentRoot, the / must be reset to the actual location (or simply DELETED). Oh, yeah, I haven’t used that standard rant in ages!

[standard rant #5][indent]I find myself repeating that the RewriteBase directive was created to UNDO a mod_alias redirection (e.g., Redirect) so, if you’ve not got any of those, there is no need to use RewriteBase. More importantly, using it inappropriately can cause mod_rewrite directives to be based on something you’re not aware of so, if you don’t NEED it, DON’T use it/indent][/standard rant #5]

It’s just too bad that this forum software won’t indent for me. :cry:

The first RewriteRule is redundant, too, as index.php is a file (first condition in the next rule set) so it, too, should be DELETED.

Finally, the second RewriteRule does not accommodate the directory request (which should already be handled by a DirectoryIndex directive) but that can be handled by adding a ? after the dot character. Then the absolute redirect to /index.php will first look at the SERVER’s root before looking at your DocumentRoot.

If those do not “create such a problem” for you, don’t fix it. On the other hand, if you’re as much a stickler for details (and optimizing code), then fix them.

RewriteEnding on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .? index.php [L]

Short & sweet, eh?

Just be glad that you didn’t employ the :fire: EVERYTHING :fire: atom (inappropriately) as my rant for that is a doozy!

OMG! The forum’s icons display during adding/editing a post but not in the board! What’s wrong with that picture?

Regards,

DK