Utherr12 Posted November 13, 2010 Share Posted November 13, 2010 I followed http://www.easymodrewrite.com/guide-syntax on how to make http rewrites but it doesn't work. I've enabled the mod and placed .htaccess in /game/changelogThe file contains:Options +FollowSymLinksOptions +IndexesRewriteEngine OnRewriteBase /RewriteRule ^changelog/([0-9]+)$ index.php?rev=$1i want to replace index.php?rev=X with changelog/X Link to comment Share on other sites More sharing options...
Dilated Posted November 15, 2010 Share Posted November 15, 2010 I followed http://www.easymodrewrite.com/guide-syntax on how to make http rewrites but it doesn't work. I've enabled the mod and placed .htaccess in /game/changelogI could be wrong here, but it sounds like you might be confused about why people use rewrites. Usually one of the most frequent uses of a rewrite is to give the appearance of directories without having actual directories for something. Most people wouldn't create a "changelog" directory if they're just going to create a rewrite that creates the appearance of a "changelog" directory. If you could give me a better idea of your directory structure and what you're trying to do I can help. e.g. where is the index.php file that you're rewriting to? Link to comment Share on other sites More sharing options...
Utherr12 Posted November 15, 2010 Author Share Posted November 15, 2010 folder changelog contains:.htaccessaddrev.phpbgsound.mp3index.phprev_page.phpi dont want my url to look like ...game/changelog/index.php?rev=X i want it to look like ...game/changelog/X Link to comment Share on other sites More sharing options...
Dilated Posted November 15, 2010 Share Posted November 15, 2010 folder changelog contains:.htaccessaddrev.phpbgsound.mp3index.phprev_page.phpi dont want my url to look like ...game/changelog/index.php?rev=X i want it to look like ...game/changelog/XOk, well I don't have much experience with nesting .htaccesses in different directories, but this is what I would do:Options +FollowSymLinks +Indexes -Multiviews # always good to turn Multiviews off, this can cause a lot of problems with rewritesRewriteEngine OnRewriteBase /game/changelog # this might always be relative to the current directory anyway, not sureRewriteRule ^(\d+)/?$ index.php?rev=$1 But, if I were doing this myself, I probably wouldn't even have a changelog directory. I would rather have one .htaccess file in the main directory which does all the work, or I would probably create a changelog.php file and place it in the "game" directory, and have the rewrite ensure that everything works accordingly. RewriteRule ^game/changelog/([^/]+)/?$ /game/changelog.php?val=$1 [QSA,L] and then in changelog.php: if (isset($_GET['val']) { if ($_GET['val'] == 'add') { //addrev.php code here } elseif ($_GET['val'] == 'rev') { //rev_page.php code here } else { //index.php?rev=$_GET['val'] code here }} else { echo('whatever here.');} You could then visit "/game/changelog/add", "/game/changelog/rev", or "/game/changelog/[number here]". Link to comment Share on other sites More sharing options...
Utherr12 Posted November 15, 2010 Author Share Posted November 15, 2010 Thank you... I will implement this change when I'm finished with my blog (i got this other project on my hands). Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.