Grow your CSS skills. Land your dream job.

.htaccess error

  • # April 17, 2013 at 5:31 am

    i have been trying to put this .htaccess code,but when i upload it ,it redirects me to the default 404 page.

    what should i do, any help RewriteEngine On
    RewriteRule ^([a-zA-Z0-9_-]+)$profile.phpu=$1
    RewriteRule ^([a-zA-Z0-9_-]+)/$profile.phpu=$1

    # April 17, 2013 at 5:35 am

    I’m not experienced with htaccess but what is `phpu`?

    `$profile.phpu`

    # April 17, 2013 at 5:39 am

    thanks,i found the error it should be $profile.php[space]u=$1

    # April 17, 2013 at 5:41 am

    Googling around I’ve seen it as such:

    RewriteEngine On
    RewriteRule ^([a-zA-Z0-9_-]+)$profile.php?u=$1
    RewriteRule ^([a-zA-Z0-9_-]+)/$profile.php?u=$1

    Notice the `?`.

    # April 17, 2013 at 5:44 am

    The above should work

    # April 17, 2013 at 5:48 am

    @chrisburton yeah , but when i use your code(with ?) it gives me error but with space in between $profile.php and u=$1 it doesn’t give any error , is that correct!

    # April 17, 2013 at 6:28 am

    Can’t test this right now, but I think you need a space after the regex:

    RewriteRule ^([a-zA-Z0-9_-]+)$ profile.php?u=$1

    # April 17, 2013 at 5:00 pm

    yes, there should be a single space.

    Also, you don’t need two rules: just make the trailing slash optional.

    RewriteRule ^([-_a-zA-Z0-9]+/?)$ profile.php?u=$1

    # May 25, 2013 at 6:12 am

    Help Me, this is not working as i am having a page profile.php but it give me error after i use the above code in .htaccess further when i remove .htaccess it doesn’t give me error but i have to use profile.php?u=
    Do .htaccess affects with subdomains as i am having subdomain for eg: – rahulkapoor.webege.com!

    # May 25, 2013 at 7:09 am

    .htaccess is fine to use with subdomains.

    Could you post your htaccess code? Please wrap it in code tags (select the text and press the “Code” link). Also, could you post the error you are getting?

    # May 25, 2013 at 7:12 am

    code is same as that of @traq(above)
    i am not getting any error but i want to use like rahulkapoor.webege.com/rahulkapoor instead of rahulkapoor.webege.com/profile.php?u=rahulkapoor but that’s not working so it leads me to default 404 page.

    # May 25, 2013 at 7:14 am

    And your htaccess code?

    # May 25, 2013 at 7:15 am

    same as that of @traq(above)

    # May 25, 2013 at 7:20 am

    Your htaccess file has one line only in it? You need to set the RewriteEngine on.

Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".