Mobile app version of vmapp.org
Login or Join
Kaufman445

: Can I redirect the HTTP request towards an old folder to the homepage using .htaccess file? I have to following situation: I had an old blog that was made using Joomla (this blog was indexed

@Kaufman445

Posted in: #Apache #Apache2 #Htaccess #Redirects #Webserver

I have to following situation: I had an old blog that was made using Joomla (this blog was indexed well enough by search engines). For some problems I delete it and I have create it again using WordPress.

Now I have many visit (from Google) that leading to specific pages of the old site (pages that don't exist in the new version).

For example I have visit to URL as: /scorejava/index.php/corso-spring-mvc/1-test that don't exist on my new site.

I would know if using the .htaccess file (or other sistem) I can redirect the HTTP request directed to some subfolder (that don't exist in the new version) to the homepage of my new site.

For example I have the request towards the void URL: /scorejava/index.php/corso-spring-mvc/1-test.

And I would create a regular expression that say something like: all the request toward the subfolder corso-spring-mvc (and all it's content file and subfolder) have to be redirected to scorejava.com.
Is it possible?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Kaufman445

1 Comments

Sorted by latest first Latest Oldest Best

 

@Shelley277

You need something like this:

RewriteEngine On
RewriteRule ^.*/corso-spring-mvc/ [R=301,L]


The regular expression can be pretty much anything. Whatever matches will be redirected to the root of your site, represented by / and the browser will get a 301 permanent redirect.

Now, I suspect you should try a more generic rule, otherwise you'll have a lot of them to write. If the old blog was under /scorejava/* for example, then you only need a rule like:

RewriteRule ^/score_java/ [R=301,L]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme