i have an really unusual problem i’ve never had before.
i’ve no .htaccess file on my server. looked everywhere, there is just no file, but a WordPress Plugin (AskApacheRewriteRules) tells me that the following Rules are active:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
any idea why that could be, i’ve already wrote my hosting provider, but their service isn’t the best.
even if i create an htaccess file with other rules and save it to my root of the server, it doesn’t change anything. The plugin always tells me the same and i believe the plugin, because i’m having issues with the /index.php/ in my url (that i don’t want to have).
any ideas?
On the AskApacheRewriteRules options page, did you make sure that
using_index_permalinksis set tofalseand thatusing_mod_rewrite_permalinksis set totrue? If this isn’t the case, WordPress will attempt to usePATH_INFOfor your permalinks, resulting in/index.php/(permalink_structure).Note that the WordPress rewrite class stores its rewrite rules as a WordPress option in the database, which is where AskApacheRewriteRules gets its information. The plugin also apparently formats the rules with the
mod_rewrite_rulesfunction before echoing them to the page, which will surround them with:So, the likely reason you can’t find the
.htaccessfile is because it doesn’t exist; the rules are just present in the database. The reason why the rules are present in the database is because you’re using permalinks, and this is the auto-generated WordPress ruleset, which is saved regardless of whether it’s actually being used or not.Edit: You must have a
.htaccessfile in the root of your web directory with the following contents:The
rewrite_rulesoption is stored atSELECT option_value FROM wp_options WHERE option_name = 'rewrite_rules', but it gets regenerated every time you change the permalink, and isn’t used except for writing to.htaccessfrom what I can tell.Anyway, those are definitely the correct rules for what you want to do. Are you sure that
mod_rewriteis enabled on your host?Edit:
Let’s make 100% sure that
mod_rewriteis working correctly and go from there.Create a
.htaccessfile in your web root with the following rules, exactly as written:Then go to your site with the URL
example.com/rwtestand see if you get redirected to StackOverflow. If not, something is wrong withmod_rewrite. If you do, then at least we know that piece isn’t the problem.