Rewrite URL and remove part with .htaccess -
i stuck .htaccess file, , need :). have wordpress installation using testing. in folder , use .htaccess there. rules use far:
######### custom ######### rewriteengine on # ignore folders rewritecond %{request_uri} "/af1wp/" rewriterule (.*) $1 [l] ############### # me # ############### # home (senne tijdeman) rewritecond %{remote_addr} ^###\.###\.###\.###$ rewritecond %{http_host} ^((www.)?([a-z0-9_\-]+).)?alleenf1.nl$ rewritecond %{request_uri} !^/af1wp/$ rewriterule ^(.*)$ /af1wp/$1 [l]
this works (with real ip address of course), no problem there. want rewrite exisiting url's new format. old url this:
http://alleenf1.nl/nieuws/qogbb/raikkonen-alles-is-mogelijk-in-australi
the new url should this:
http://alleenf1.nl/raikkonen-alles-is-mogelijk-in-australi
the part want remove "nieuws/qogbb/" not same, have use regex that. tried did not work @ all.
i thought simple, apparently not me unfortunately. have 2 questions.
- what right rewriterule this?
- where should put it. in .htaccess of root folder, or af1wp folder wordpress install is?
tnx in advanced
to awnser questions poncha below:
- yes, url's start folders. clarify (was not clear) part "nieuws" same, not second part (call id).
- i prefer redirect.
- the file
/raikkonen-alles-is-mogelijk-in-australi
post in wordpress. wordpress installation resides in folder af1wp, moved root folder when going live.
try this:
rewriteengine on rewriterule ^nieuws/([^/]+)/(.*) /af1wp/$1 [r=301,l,qsa]
- this match urls starting "nieuws"
- for now, rewrite target
/af1wp/
, change/
when moving wordpress. - when move wordpress, you'll need mix in rule inside wordpress rules, has rewrite rules of own - place rule above rules.
- the flags used here:
r=301
- redirect http status 301 (moved permanently).l
- last rule (stop rules parsing after successful match of rule)qsa
- query-string-append (append original query string rewritten request).
Comments
Post a Comment