Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I am trying to get the URL www.mysitedomain.com/blogs/displaynamehere to show what is in the directory at www.mysitedomain.com/blogs/blog.php$display=displaynamehere

So thanks to the people who helped me here I know I need to use a Mod Rewrite How to make parameters look more attractive

The contents of my HT access is at follows. The first is a re direct generated by my hosting, the second is my attempt at the mod re write which is not working.

# DO NOT REMOVE THIS LINE AND THE LINES BELOW REDIRECTID:Hjz5g3
RewriteEngine on
RewriteCond %{HTTP_HOST} ^joelhoskin.net76.net$ [OR]
RewriteCond %{HTTP_HOST} ^www.joelhoskin.net76.net$
RewriteRule ^$ http://www.joelhoskin.net76.net/flexdevs [R=301,L]
# DO NOT REMOVE THIS LINE AND THE LINES ABOVE Hjz5g3:REDIRECTID

RewriteEngine On
RewriteCond %{HTTP_HOST} ^joelhoskin.net76.net/blogs/(.*)$ [OR]
RewriteCond %{HTTP_HOST} ^www.joelhoskin.net76.net/blogs/(.*)$
RewriteRule ^$ http://www.joelhoskin.net76.net/blogs/blog.php?display=$1 [L]

Thanks everyone

share|improve this question

1 Answer 1

up vote 0 down vote accepted

The host shouldn't contain anything after the slash. So you want:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^joelhoskin.net76.net$ [OR]
RewriteCond %{HTTP_HOST} ^www.joelhoskin.net76.net$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^blogs\/(.*)$ http://www.joelhoskin.net76.net/blogs/blog.php?display=$1 [L]
share|improve this answer
    
Thanks for your help it worked a treat it did re-direct however chrome gave me this error Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects. Firefox throws "Firefox has detected that the server is redirecting the request for this address in a way that will never complete." –  Joel Jul 26 '11 at 12:30
    
Actually it seems to have that error on the enter /blogs directory –  Joel Jul 26 '11 at 12:36
    
joelhoskin.net76.net/blogs/blog.php?display=blog.php Every page just redirects here, however I have a redirect in the blog.php that if the display doesnt exist it redirects back to the blogs/index.php and since that page redirects to the previous one its caught in a loop –  Joel Jul 26 '11 at 12:41
    
@paulmorriss There is no need to escape slash / character at all. –  LazyOne Jul 26 '11 at 12:50
    
Ok I removed all escape slashes and now the entire site just 404s –  Joel Jul 26 '11 at 13:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.