Link to home
Start Free TrialLog in
Avatar of shortandsharp
shortandsharp

asked on

apache, perl, rewriting rules

Hi, I'm currently trying to figure out how to do a rewrite on my wordpress which is on apache 2.0 fedora 5.

It is not connected to the Internet.

So how do I perform a rewrite on apache 2.0

I need to convert

http://192.168.xxx.xxx/wordpress/?post_id

to

http://192.168.xxx.xxx/wordpress/post_id/post)name

thanks a lot!
Avatar of ravenpl
ravenpl
Flag of Poland image

create .htaccess file in Your wordpress flolder with following content

RewriteEngine On
RewriteRule ^\?(.+) post_id/$1

But please fix Your example, it's unclear what exactly You want.
Avatar of shortandsharp
shortandsharp

ASKER

okay example

from

http://192.168.123.237/wordpress/?p150

to

http://192.168.123.237/wordpress/150/if-your-scanner-software-is-not-online-please-buy-a-new-scanner

where p150 = pid
and
if-your-scanner-software-is-not-online-please-buy-a-new-scanner = postname

thanks
> where p150 = pid
> and
> if-your-scanner-software-is-not-online-please-buy-a-new-scanner = postname
What is pid and postname?
http://codex.wordpress.org/Using_Permalinks

pid is %post_id%

postname is  %postname%

thanks
So You rather want the url
http://192.168.123.237/wordpress/150/if-your-scanner-software-is-not-online-please-buy-a-new-scanner
to be rewritten to
http://192.168.123.237/wordpress/?pid=150&postname=if-your-scanner-software-is-not-online-please-buy-a-new-scanner
Right?

#wordpress/.htaccess
RewriteEngine On
 RewriteRule ([^/]+)/([^/]+) script_handler.pl?pid=$1%postname=$2 [L]
no,

in general it means

http://192.168.123.237/wordpress/150/if-your-scanner-software-is-not-online-please-buy-a-new-scanner
to be rewritten to
http://192.168.123.237/wordpress/?pid=150

if another post

http://192.168.123.237/wordpress/149/buy-dish-network
to be rewritten to
http://192.168.123.237/wordpress/?pid=149

this concerns wordpress way of doing things, I'm figuring out how do the host do the rewrite.

Rewrite is different from redirection.

Rewrite actually  means if I display

http://192.168.123.237/wordpress/149/buy-dish-network

then it will be

displaying content from http://192.168.123.237/?p=149

thanks
ASKER CERTIFIED SOLUTION
Avatar of ravenpl
ravenpl
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial