Forum

Thread tagged as: Problem, Configuration, Blog

Remove trailing slash in htacces breaks my /blog/ page

At the moment any of my pages with a / at the end returns a 404 rather than being re-directed to the one without the slash.

However upon adding this in the htaccess it breaks my /blog/ page.

Kieran Hunter

Kieran Hunter 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You'll need to provide more information for anyone to be able to help you with that.

Hey,

What other information would you like? I didn't think the Perch diagnostics would be of any use in my case?

Thank you

Kieran

Drew McLellan

Drew McLellan 2638 points
Perch Support

  1. What do you have in your htaccess

  2. What are you changing

  3. How does it break?

Oh, sorry. Please see as follows.

Im trying to add a little piece of code that directs and end slash / eg: /about/ to eg: /about

It works fine, but my default /blog/ page breaks, as in it doesn't show, because it needs the end slash, like the post pages and archive pages form the blog wont show either.


<IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access plus 1 year" ExpiresByType image/jpeg "access plus 1 year" ExpiresByType image/gif "access plus 1 year" ExpiresByType image/png "access plus 1 year" ExpiresByType text/css "access plus 1 month" ExpiresByType application/pdf "access plus 1 month" ExpiresByType text/x-javascript "access plus 1 month" ExpiresByType application/x-shockwave-flash "access plus 1 month" ExpiresByType image/x-icon "access plus 1 year" ExpiresDefault "access plus 2 days" </IfModule> <ifModule mod_gzip.c> mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_item_include file .(html?|txt|css|js|php|pl)$ mod_gzip_item_include handler ^cgi-script$ mod_gzip_item_include mime ^text/.* mod_gzip_item_include mime ^application/x-javascript.* mod_gzip_item_exclude mime ^image/.* mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* </ifModule> <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}\.php -f RewriteRule ^(.+)$ $1.php [L,QSA] RewriteRule ^detail/([a-zA-Z0-9-]+)$ /detail.php?s=$1 [L] RewriteRule ^category/([a-zA-Z0-9-/]+)$ /category.php?cat=$1 [L] RewriteRule ^blog/([a-zA-Z0-9-]+)$ /blog/post.php?s=$1 [L] RewriteRule ^blog/([a-zA-Z0-9-]+)/preview$ /blog/post.php?s=$1&preview=all [L] RewriteRule ^blog/category/([a-zA-Z0-9-]+)/page/([0-9]+)/{0,1}$ /blog/archive.php?cat=$1&page=$2 [L] RewriteRule ^blog/category/([a-zA-Z0-9-]+)$ /blog/archive.php?cat=$1 [L] RewriteRule ^blog/date/([a-zA-Z0-9-]+)/page/([0-9]+)/{0,1}$ /blog/archive.php?year=$1&page=$2 [L] RewriteRule ^blog/date/([a-zA-Z0-9-]+)$ /blog/archive.php?year=$1 [L] RewriteRule ^blog/date/([a-zA-Z0-9-]+)/([a-zA-Z0-9-/]+)/page/([0-9]+)/{0,1}$ /blog/archive.php?year=$1&month=$2&page=$3 [L] RewriteRule ^blog/date/([a-zA-Z0-9-]+)/([a-zA-Z0-9-/]+)$ /blog/archive.php?year=$1&month=$2 [L] RewriteRule ^blog/tag/([a-zA-Z0-9-]+)/page/([0-9]+)/{0,1}$ /blog/archive.php?tag=$1&page=$2 [L] RewriteRule ^blog/tag/([a-zA-Z0-9-]+)$ /blog/archive.php?tag=$1 [L] RewriteRule ^blog/([a-zA-Z0-9-]+)/([a-zA-Z0-9-/]+)/page/([0-9]+)/{0,1}$ /blog/archive.php?year=$1&month=$2&page=$3 [L] RewriteRule ^blog/([a-zA-Z0-9-]+)/([a-zA-Z0-9-/]+)$ /blog/archive.php?year=$1&month=$2 [L] RewriteRule (.*).xml(.*) $1.php$2 [nocase] #Old posts re-direct Redirect 301 /my-portfolio /portfolio Redirect 301 /welcome-to-my-portfolio-site /blog/welcome-to-my-portfolio-site Redirect 301 /new-canon-450d /blog/my-new-canon-450d Redirect 301 /google-authorship-now-works /blog/how-to-make-your-google-authorship-work Redirect 301 /my-first-codepen /blog/my-first-codepen Redirect 301 /wordpress-theme-development /blog/developing-my-custom-wordpress-theme Redirect 301 /my-review-on-sniper-elite-3-xbox-one /blog/my-review-on-sniper-elite-3-xbox-one Redirect 301 /custom-project-types-for-your-portfolio /blog/custom-project-types-for-your-portfolio Redirect 301 /custom-social-share-buttons-author-information /blog/custom-social-share-buttons-with-author-information Redirect 301 /social-media-icons-with-hover-titles /blog/social-media-icons-with-hover-titles Redirect 301 /creating-perfect-favicon /blog/creating-the-perfect-favicon Redirect 301 /javascript-image-animation-frames /blog/javascript-image-animation-frames Redirect 301 /hide-your-arms-t-shirt-blog /blog/hide-your-arms-t-shirt-blog Redirect 301 /the-joy-of-sublime-text-2 /blog/the-joy-of-sublime-text-2 Redirect 301 /implementing-wordpress-post-formats /blog/implementing-wordpress-post-formats Redirect 301 /using-icomoon-icons /blog/the-best-way-to-implement-font-icons Redirect 301 /how-to-test-your-fish-water-and-resolving-nitrite-poisoning /blog/how-to-test-your-fish-water-and-resolving-nitrite-poisoning Redirect 301 /update-on-my-aquariums-nitrite-poisoning /blog/update-on-my-aquariums-nitrite-poisoning Redirect 301 /next-previous-wordpress-post-links /blog/next-previous-wordpress-post-links Redirect 301 /shouldnt-using-target_blank-outbound-links /blog/why-you-shouldnt-be-using-target-blank-for-outbound-links Redirect 301 /set-photoshop-document-brush-presets-illustrate-using-tablet /blog/how-to-set-up-your-photoshop-document-and-brush-presets-to-illustrate-using-a-tablet Redirect 301 /migrating-wordpress-perch-cms /blog/migrating-from-wordpress-to-perch-cms Redirect 301 /uk-plugs-logo-web-design /blog/uk-plugs-logo-web-design Redirect 301 /pug-love-photoshop-illustration /blog/pug-love-photoshop-illustration Redirect 301 /feather-threadless-submission /blog/feather-threadless-submission Redirect 301 /fresh-new-theme-from-themeforest /blog/fresh-new-theme-from-themeforest Redirect 301 /5-web-design-and-blog-trends-for-you-to-think-about-for-2014 /blog/5-web-design-and-blog-trends-for-you-to-think-about-for-2014 Redirect 301 /social-media-image-sprites /blog/social-media-image-sprites Redirect 301 /final-fantasy-x-x-2-hd /blog/final-fantasy-xx-2-hd-review #block libwww-perl RewriteCond %{HTTP_USER_AGENT} libwww-perl.* RewriteRule .* – [F,L] #re-direct https://www. to https:// RewriteCond %{HTTP_HOST} ^www\.kieranhunter\.co.uk$ RewriteRule ^/?$ "http\:\/\/kieranhunter\.co.uk\/" [R=301,L] </IfModule>
Drew McLellan

Drew McLellan 2638 points
Perch Support

What happens when the don't show? Do you get an error? What does the debug output?