.htaccess and URL Ending with Forward Slash
-
Hello,
I would like to get some advice. I’m experiencing a problem with infinite number of urls ending with forward slashes at my wordpress blog, internettvdotcom(dot)com/ .
After changing my theme and permalink structure from /%postname%/ to /%postname% about a year ago, I have been getting tons of 404 page errors showing up in the Google Webmaster Tools..
Here is a sample of URLs that include my inner pages ending with forward slashes (/). They are showing up as 404 errors. When I remove the ending / it takes me to the correct post:
https://internettvdotcom(dot)com/streamdirecttvreview-is-stream-direct-a-scam-or-is-it-scam-free/
https://internettvdotcom(dot)com/satellite-direct-review/
https://internettvdotcom(dot)com/satellite-direct-tv-qa/
I found what may be an answer to my question but I’m not 100% sure. So my question is do I need to change my .htaccess file to remove the forward slash problem?
This is my current .htaccess file without the W3 Total Cache and it’s the same as the answer I found on another site…
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPressHowever, in the second part of the answer it said to try using the .htaccess file below if the first one didn’t work…
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]RewriteRule (.+)/$ https://www.domain.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>QUESTION: In the RewriteRule (.+)/$ https://www.domain.com/$1 [R=301,L] section… should I replace the https://www.domain.com/ with https://internettvdotcom(dot)com/ (I never use the www) or use https://www.internettvdotcom(dot)com/ to fix my forward slash problem?
Any advice will be greatly appreciated!
- The topic ‘.htaccess and URL Ending with Forward Slash’ is closed to new replies.