Myst
Myst

Reputation: 553

Manually mod_rewrite each page

I tried everything on this world to make it work properly but it simply won't. I'm done with auto rewrite. You can still answer if you think you know what could be causing this but I doubt it's possible.

Question: How would I go on manually mod_rewrite each page like so:

domain.com/showthread.php?id=00 to domain.com/showthread?id=00

(I have asked before (Remove .php from URL) how to automatically rewrite this but I just cannot get it to work properly and I'm running out on time and energy. and coffee.)

Issue:

Even though

<?php 
phpinfo();

Lists mod_rewrite as enabled

<?php
 if(!function_exists('apache_get_modules') ){ phpinfo(); exit; }
 $res = 'Module Unavailable';
 if(in_array('mod_rewrite',apache_get_modules())) 
 $res = 'Module Available';
?>
<html>
<head>
<body>
<p><?php echo apache_get_version(),"</p><p>mod_rewrite $res"; ?></p>
</body>
</html>

Displays "Module Available"

..it still does not function.

I tried the following a.o.:

(1)
# Apache Rewrite Rules
 <IfModule mod_rewrite.c>
  Options +FollowSymLinks
  RewriteEngine On
  RewriteBase /

# Add trailing slash to url
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$
  RewriteRule ^(.*)$ $1/ [R=301,L]

# Remove .php-extension from url
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME}\.php -f
  RewriteRule ^([^\.]+)/$ $1.php 

# End of Apache Rewrite Rules
 </IfModule>
(2)
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC,L]
(3)
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php
(4)
RewriteRule ^page$ page.php [L]

Notes:

ATTENTION:

Please read the post before answering. I'm pretty sure this is not your average mod_rewrite issue.

Upvotes: 0

Views: 90

Answers (1)

Deepak Vishwakarma
Deepak Vishwakarma

Reputation: 106

I suppose your htaccess isn't working at all. Check in apache conf file for following ... AllowOverride None ...

and change it to AllowOverride All

Upvotes: 1

Related Questions