Irfan
Irfan

Reputation: 7059

How to redirect /blog to /blog/?

I want to redirect /blog to /blog/. I have two condition if blog is in the url first condition will be called else second condition. Please anybody help me to do this.

I did this.

#blog
RewriteCond %{REQUEST_URI} ^/blog.*
RewriteRule (.*)           /blog/$1   [L]

#squeezepage
RewriteEngine On 
RewriteRule ^([0-9a-zA-Z]+)$ index.php?option=com_squeezepage&sqpage=$1 [NC]

Thanks.

Upvotes: 1

Views: 452

Answers (3)

OnlineBill Expert
OnlineBill Expert

Reputation: 1

The option to manually redirect the path "/blog" to "/blog/" by implementing a redirection rule. However, it's worth noting that if "/blog" corresponds to a physical folder, Apache automatically handles the trailing slash for you.

Upvotes: 0

anubhava
anubhava

Reputation: 786241

You can do something like this to redirect /blog to /blog/ however if /blog is a physical folder then Apache does it automatically for you:

RewriteRule ^blog$ /blog/ [L,R=301,NC]

Upvotes: 2

styfle
styfle

Reputation: 24720

Do you only want the trailing slash for /blog requests or do you want it for all directories? Because there is a directive called DirectorySlash on which might be what you're looking for.

See this question.

Upvotes: 0

Related Questions