regex


.htaccess URL rewriting adivce - remove text from url [closed]


how to redirect the following with .htaccess file, i tried & i figured out to write rule for redirect each url, but how to write a common rule.
need to remove the text "article" form the URL,
examples:
zzz.com/article/a/b to zzz.com/a/b
zzz.com/article/g/h to zzz.com/g/h
zzz.com/article/c/v to zzz.com/c/v
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your DOCUMENT_ROOT/.htaccess file:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?zzz\.com$ [NC]
RewriteRule ^article/(.*) /$1 [L,NC]
PS: If you want external redirection then use:
RewriteCond %{HTTP_HOST} ^(www\.)?zzz\.com$ [NC]
RewriteRule ^article/(.*) /$1 [L,NC,R]

Related Links

Perl: Multiple lookbehind regex in a single regex expression
mod_rewrite to nginx rewrite rules
Perl Binary/PCAP regex
Why does grep match all lines for the pattern “\'”
regular expression for C if statementch
Regular expression for search name of methods in java files
Recommendation - Resource/book/pocketbook on regex in SED [closed]
Perl: composing regex thru interpolation when subexpr has capture
RegExp regular expression find & replace whole words only
Given a certain regex pattern, re-arrange and manipulate the contents of a cell
Regular expression“\\|” in strsplit
Parsing sectioned file with augeas
I need search a pattern in a header line of my file and concatenates the next line with Perl
Regular Expression statement to replace text inside two literals
RegEx pattern with not followed by
How to pull words based on positioning from a text element using Regex?

Categories

HOME
elastic-beanstalk
ssl
sqlite
web-services
lua
sharepoint-2013
module
logback
mvvm-light
doorkeeper
helpers
html-email
drupal-commerce
slowcheetah
ghost-blog
dotnetbar
pcap
datamatrix
hough-transform
urlrewriter.net
bitcode
desktop-app-converter
simple-html-dom
effects
x-sendfile
editorconfig
kprobe
pvlib
tensor
nib
jetty-9
perl-module
atlassian-bitbucketserver
visualsvn-server
tern
android-studio-2.1
integer-programming
oracle-aq
derbyjs
maven-versions-plugin
billing
db2400
sizing
itamae
django-errors
gwt-material-design
proc
xceed
git-config
file-management
4d
geneos
submission
vb6-migration
viewengine
jca
id3
administrator
flexigrid
kinto
cng
hypervisor
wt
android-listfragment
keypad
pencilblue
smarty2
generalization
zim-database
android-tablelayout
razor-2
gdk
iphone-privateapi
magic-unipaas
requiredfieldvalidator
antisamy
nawk
couchrest
mod-python
semantic-markup
rte
globbing
gdb-python
mosek
angularjs-module
square-cube
memento
locomotivejs
wescheme
consistent-hashing
semantic-zoom
stumbleupon
plinqo
android-3.1
rails-3.1
msn-messenger
gedcom
development-machine
user-testing

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App