Mobile app version of vmapp.org
Login or Join
Gretchen104

: Need help writing .htaccess / Apache rule I have some URLs which are now 404 due to site upgrade. I want all URLs starting with www.example.com/archives/* to point to www.example.com/news (notice

@Gretchen104

Posted in: #Apache #Htaccess

I have some URLs which are now 404 due to site upgrade.

I want all URLs starting with example.com/archives/* to point to example.com/news (notice that after archives there is a wildcard char).

Can someone here please help me with the code for .htaccess rules?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Gretchen104

2 Comments

Sorted by latest first Latest Oldest Best

 

@Angie530

To learn about .htaccess writing rules you can refer the official link of
Apache Module mod_rewrite: httpd.apache.org/docs/current/mod/mod_rewrite.html.
And for URL rewriting guide: httpd.apache.org/docs/2.0/misc/rewriteguide.html.

10% popularity Vote Up Vote Down


 

@Courtney195

I assume you want to redirect permanently:

RedirectMatch 301 ^/archives/.* www.example.com/news

I've placed this rule in tariffplansindia.com test it there.

Here is another:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example.com/archives [NC]
RewriteRule ^archives/(.*) example.com/news [R=301,L]


I've placed this rule in rtidiary.org test it there.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme