How do I rewrite /*/ to /content/public/work/*

Can you please give me a code sample I can use, because you’re saying I need to move the ! to the regex, and I think I already have but you’re saying I haven’t.

Here’s the code I’m using for now.

What I want is /projects/clickrobot to show the /public_html/content/projects/clickrobot folder whilst not making the /projects page inaccessible.

des,

What you’ve just shown is correct but please look at the !'s below.

ARGH! We used to be able to apply color to the text but bold will have to do. Look for it in THREE places where it is RewriteCond !%{REQUEST_URI} … and <= ! off to the end of the line.

Regards,

DK

Try [color=red]whatever[/color] inside quote
* need to \ escape # and any _ not between letters

# Rewrite any calls to /* or /app to the index.php file

RewriteCond %{REQUEST_URI} /app/$
RewriteCond !%{REQUEST_URI} /projects/clickrobot/$ /* desbest edit / <= !
RewriteRule ^app/ index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond !%{REQUEST_URI} /projects/clickrobot/$ /
desbest edit / <= !
RewriteRule ^(.
)/$ index.php?$1 [L]

# Rewrite /projects/* to /content/projects/*
RewriteRule ^(projects/.*)$ /content/$1 [L,NC,R=302]

# Rewrite any file calls to the public directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !public/
RewriteCond !%{REQUEST_URI} /projects/clickrobot/$ /* desbest edit */ <= !
RewriteRule ^(.+)$ public/$1 [L]

I know both you lot said that my edits with the exclamation mark would make it work, but it doesn’t make it work. Will it ever get to the point where I let you have access to an FTP account, or should I just forget it and use a different directory structure for certain things?

When I get http://desbest.uk.to/projects/clickrobot to work, http://desbest.uk.to/projects FAILS
When I get http://desbest.uk.to/projects/ to work, http://desbest.uk.to/projects/clickrobot FAILS

All because the /public_html/content/projects/clickrobot folder uses a standard html file, instead of using the ..txt file that the Stacey cms expects to see.

Thanks, Alan, I should have remembered (and tried) that. Up to my @$$ in alligators this AM is my only excuse.

Regards,

DK

des,

Remove the <= ! at the end of the three lines with the !%{REQUEST_URI} as I put those outside your comment tags.

Regards,

DK

Here’s the htaccess you both told me to have, which I’m using right now.

It breaks my site, more specifically, the “desbest edit” lines.
http://desbest.uk.to/projects FAILS
http://desbest.uk.to/projects/clickrobot FAILS

des,

That’s because you are insisting on leaving the !%{REQUEST_URI} as the string to match with the regex which follows it. Comments on your code are embedded

RewriteEngine on
 
# Some hosts require a rewritebase rule, if so, uncomment the RewriteBase line below. If you are running from a subdirectory, your rewritebase should match the name of the path to where stacey is stored.
# ie. if in a folder named 'stacey', RewriteBase /stacey
# RewriteBase /
 
#ErrorDocument 404 /404.html
 
# Rewrite any calls to *.html, *.json, *.xml, *.atom, *.rss, *.rdf or *.txt if a folder matching * exists
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !public/
RewriteCond %{DOCUMENT_ROOT}/public/$1.$2 !-f # redundant
RewriteRule (.+)\.(html|json|xml|atom|rss|rdf|txt)$ $1/ [L] # strips file extension and adds trailing / (BAD technique, IMHO)
 
# Add a trailing slash to directories
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.) # is not anything? This looks like a major error
RewriteCond %{REQUEST_URI} !(.*)/$ # ditto
RewriteRule ([^/]+)$ $1/ [L] # adds a trailing / (still BAD IMHO)
 
# Rewrite any calls to /* or /app to the index.php file
RewriteCond %{REQUEST_URI} /app/$
		#desbest edit
		RewriteCond [color=red]![/color]%{REQUEST_URI} /projects/clickrobot/$ # you're not getting the message about the string being checked!
RewriteRule ^app/ index.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
		#desbest edit
		RewriteCond [color=red]![/color]%{REQUEST_URI} /projects/clickrobot/$ # same-o
RewriteRule ^(.*)/$ index.php?$1 [L] # creating an improperly formed query string???

  # Rewrite /projects/* to /content/projects/*
  RewriteRule ^(projects/.*)$ /content/$1 [L,NC,R=302] # No Case flag is an error; {REQUEST_URI} IS case sensitive
 
# Rewrite any file calls to the public directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !public/
	#desbest edit
	RewriteCond [color=red]![/color]%{REQUEST_URI} /projects/clickrobot/$ # same-o
RewriteRule ^(.+)$ public/$1 [L]
 
## rewrite /*/ to /content/public/work/* 
# If the request is not for a valid directory
#RewriteCond %{REQUEST_FILENAME} !-d
# If the request is not for a valid file
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^((?!content/work/).*) content/work/$1 [L,NC]

I take great exception to you telling SitePoint members that “we” gave you this code. Obviously, I have great problems with it and will now leave it to you to resolve.

Regards,

DK