Jump to content

Recommended Posts

Hello Everyone,

 

I started working on a "clean url" process about a week ago.  I have watched several youtube videos, read blogs/tutorials/forums, and have even used a mod_rewrite generated script @ http://www.generateit.net/mod-rewrite/.  All I have to show for it is less hair and a deeper appreciation for people who understand this kind of stuff. 

 

I am hosting my website through gatorhost this particular domain is a sub domain of my site and the file hierarchy is that the subdomain is a child of my site. 

 

here is the url i am working with: 

http://arianadev.rppdesigns.com/index.php?page=SS.php

 

I want it to be cleaned so it reads :

 

http://arianadev.rppdesigns.com/SS.php

 

or

 

http://arianadev.rppdesigns.com/page/SS.php

 

 

This first snippet of code causes my site to result in a "Internal Server Error"

htaccess snippet 

Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteRule ^([^/]*)$ /index.php?page=$1 [L]

 

 

With the following code the site runs but the urls are the same.

htaccess snippet 

Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteRule ^page/([^/]*)\.html$ /index.php?page=$1 [L]

 

If any one could be of any assistance that would greatly be appreciated.

 

Thank you

 

 

Link to comment
https://forums.phpfreaks.com/topic/261757-mod-rewrite-internal-server-error/
Share on other sites

The first URL would be easy if /SS.php didn't actually exist (like it was in an include/ directory or something).

RewriteEngine on

# does not exist as a file
RewriteCond %{REQUEST_FILENAME} !-f
# does not exist as a directory
RewriteCond %{REQUEST_FILENAME} !-d
# rewrite any /*.php through index.php
RewriteRule ^[^/]+\.php$ index.php?page=$0 [L]

 

If it does exist then the second URL would be easier because then you could assume anything in /pages/ is supposed to go through /index.php.

RewriteEngine on

RewriteRule ^pages/(.*)$ index.php?page=$1 [L]

 

 

And FYI,

 

Your first try causes a loop. The first time through it will rewrite every file in the root to index.php. The next pass will rewrite index.php back onto itself. The next pass will do it again. And again. Contrary to popular belief, [L] does not stop rewriting entirely.

The second one... I'm not sure what you expected it to do. The URL will still be "/page/file.html" - that won't change. Are you talking about how "/index.php?page=file.html" URL doesn't change?

Thank you for the speedy response...

 

The first URL would be easy if /SS.php didn't actually exist

This is a call to the db, when I first set it up I decided to try by page name and for some reason decided to keep the file extension even though it is just a place holder in the db.

 

I have updated my old naming convention to the following:

 

Menu=Appetizers

Menu=Specials

Menu=SoupsSalads

Menu=Entrèes

Menu=VegOptions

Menu=Desserts

 

For this reason I updated your code example to the following

 

RewriteEngine on

 

RewriteRule ^Menu/(.*)$ index.php?Menu=$1 [L]

 

However, my urls still stay in the same format:

 

 

when I would like

 

is there a way to problem shoot each step something like the following:

 

is rewrite on?

does it parse the url?

does it take the menu name as an argument?

 

Since I am hosting my site through hostgator I don't have my own personal httpd.conf file.  I have been concerned since the beginning that rewrite is just not on.

 

Any further assistance would be appreciated.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.