Reputation: 21
hmm I have a problem with my .htaccess, I wanted to rewrite this:
to this
In other words... I want to delete the "thread-" and everything after the "." The /a/ must be variable... there are other forums with /bla/ and /code/
Do you have a clue for me? Thank you
My .htaccess right now:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.phpRewriteCond %{THE_REQUEST} ^[A-Z]+\ /index.php
RewriteRule ^index.php/?(.*) /$1 [L,R=301]
Upvotes: 1
Views: 532
Reputation: 41838
Add this to the .htaccess
file in your DOCUMENT_ROOT
RewriteEngine On
RewriteRule ^([^/]+)/thread-(\d+) $1/$2? [DPI,L,R]
Tested in Apache 2.2 and 2.4 :)
This assumes that mod_rewrite is both installed and activated for htaccess files.
If you are not sure, to check if mod_rewrite is installed, look at the list of installed modules in the output of phpinfo();
By default, mod_rewrite is not enabled for htaccess files. If you are managing your own server, open httpd.conf
and make sure that the webroot directory block contains one of these lines: AllowOverride FileInfo
or AllowOverride All
Upvotes: 1