URL Mod-Rewrite?

Security-services. Php? Service=$1 L The part that says security-services/(.*)/?

Matches the URL in the browser and rewrites it to security-services. Php The key part is the (.*) which captures that portion of the URL and passes it to the PHP script as a GET value.

An . Htaccess file with something like this should do it. Options +FollowSymLinks RewriteEngine On RewriteRule security-services/(.*)/?

Security-services. Php? Service=$1 L The part that says security-services/(.*)/?

Matches the URL in the browser and rewrites it to security-services.php. The key part is the (.*) which captures that portion of the URL and passes it to the PHP script as a GET value.

Thanks for replying! I've done what you've suggested and the page loads fine. The only problem I'm facing is capturing the 'service' variable.

Let's say I want to test it, on the original example I'd have: example. Com/… and could test with "echo $_REQUEST'service'" New example, example. Com/security-services/fixed-camera-surveillance I want "fixed-camera-surveillance' to be echo'd.

Suggestions? – Mike B. Nov 9 '09 at 20:52 Have you tried it?

The code above does it, it takes anything it finds with the (.*) regex and dumps it where you see the $1, so your script at the security-services. Php file. – MalphasWats Nov 9 '09 at 21:05 Yes, I've tried it.

I want to capture 'fixed-camera-surveillance' from the URL '.../security-services/fixed-camera-surveillance'. Would I be asking for 'service' as before, or is it just stored in $1? – Mike B.

Nov 9 '09 at 21:18 The first group of () is $1, the second $2, and so on. So you can capture multiple things and then use them in the rewrite part of the rule. – Mark Biek Nov 9 '09 at 21:41 Thanks Mark for getting back to me.

I'm sorry; either I'm misunderstanding you, or you to me (probably to former). I've implemented your solution, as is. Could you literally write a PHP command to get the contents of /.../ (or $1 as you've described).

Is not doing the trick. Thanks! – Mike B.

Nov 9 '09 at 22:08.

Try this rule: RewriteEngine on RewriteRule ^security-services/(^/+)$ security-services. Php? Service=$1 L The ^/+ describes the next path segment after /security-services, (…) forms a group that’s match then can referenced to with $1 in the substitution.

And if you want a more general for any kind of …-service. Php file: RewriteEngine on RewriteRule ^(^/-+)-services/(^/+)$ $1-services. Php?

Service=$2 L.

Thanks for replying! I've done what you've suggested and the page loads fine. The only problem I'm facing is capturing the 'service' variable.

Let's say I want to test it, on the original example I'd have: example. Com/… and could test with "echo $_REQUEST'service'" New example, example. Com/security-services/fixed-camera-surveillance I want "fixed-camera-surveillance' to be echo'd.

Suggestions? – Mike B. Nov 9 '09 at 20:53 @Mike B.

: That should work the same way. You shouldn’t notice any difference. – Gumbo?

Nov 9 '09 at 21:39.

Security-services. Php? Service=$1 If you're using a .

Conf file, change ^ to.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions