Need help. Info inside

Discuss practical ways rearrange URLs using mod_rewrite.

Need help. Info inside

Postby Washi » Thu Mar 03, 2005 12:28 pm

Hi,

I've spent the last, oh 3 or 4 hours looking for this kind of thing, but I didn't find anything that helped, so here I am.

I have a dynamic PHP site. indexx.php is in the main directory, and the files that are included (text files) are in a directory called inc.

Basically, indexx.php is the layout, and the files inside inc/ are the text.

Now, most of my links are something like http://subdomain.mydomain.com/indexx.ph ... s=whatever

What I would like to find is a rewrite that allows people who want to access, for instance

http://subdomain.mydomain.com/inc/whatever.php

to be directly redirected to

http://subdomain.mydomain.com/indexx.ph ... s=whatever

so that the layout can be seen.

I have checked out about 30 kinds of htaccess, and none of the codes worked. Thanks.
Washi
 

Postby Caterham » Thu Mar 03, 2005 1:14 pm

have a try on
Code: Select all
RewriteEngine On
RewriteRule ^inc/(.+)\.php /index.php?shadows=$1 [L]
in your .htaccess in the doc root

bob
Caterham
 
Posts: 690
Joined: Fri Dec 10, 2004 1:30 pm

Postby Guest » Thu Mar 03, 2005 2:33 pm

Ok, I just tried that, and it does give me some elements of the page, but not all, and the address is still

http://subdomain.domain.com/inc/file.php

The images don't show. Do I need to put the whole layout style in there?
Thanks.
Guest
 

Postby Caterham » Thu Mar 03, 2005 3:17 pm

so you're looking for a forced external redirect, not an internal one?

Code: Select all
RewriteEngine On
RewriteRule ^inc/(.+)\.php /index.php?shadows=$1 [R,L]
Add the R-Flag for an temporary redirect (statuscode 302) or add [R=301,L] for a permanent redirect
Caterham
 
Posts: 690
Joined: Fri Dec 10, 2004 1:30 pm

Postby Guest » Thu Mar 03, 2005 5:18 pm

Caterham wrote:so you're looking for a forced external redirect, not an internal one?

Code: Select all
RewriteEngine On
RewriteRule ^inc/(.+)\.php /index.php?shadows=$1 [R,L]
Add the R-Flag for an temporary redirect (statuscode 302) or add [R=301,L] for a permanent redirect


You are a god! A God I Say! Thank you so much!
Guest
 


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 47 guests

cron