apache - Rewrite directory to another to stop 404 with htaccess -


a decision made rename directory on our website. have number of old url's indexed google return 404 errors.

i try , create rewrite .htaccess resolve problem. directory renamed job jobs

so example like: https://myurl.com/job/sales-manager-jobs-in-havant

to like: https://myurl.com/jobs/sales-manager-jobs-in-havant

i have rewriting in place creates these seo friendly urls single-joblisting.php?id=1

this sits in jobs directory , looks this:

options -multiviews rewriteengine on rewritebase /jobs/  rewritecond %{request_filename} !-d rewriterule ^([\w-]+)/?$ single-joblisting.php?id=$1 [l,qsa] 

i had ask above rewrite working. issue?

you can use following redirect:

redirectmatch 301 ^/job/(.+)$ /jobs/$1 

this permanently redirect

  • /job/foobar

to

  • /jobs/foobar

Comments

Popular posts from this blog

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -