如何解决如何编写保留$ _POST并一致删除文件扩展名的.htaccess?
今天早上,我正试图从我正在工作的网站中删除文件扩展名。虽然我不熟悉.htaccess文件,但我正在尝试在线学习它们及其正则表达式。我尝试的第一个未能保存$ _POST值,因此破坏了网站。我在这里找到了较长的.htaccess代码块,并尝试使用它,它可以很好地解决发布问题。
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10'
implementation 'com.google.android.material:material:1.2.0'
implementation 'com.google.android.gms:play-services-ads-lite:19.3.0'
implementation 'com.squareup.retrofit2:retrofit:2.8.1'
implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
//implementation 'androidx.appcompat:appcompat:1.3.0-alpha01'
//implementation "androidx.core:core-ktx:1.3.1"
implementation "androidx.fragment:fragment-ktx:1.2.5"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0-alpha07'
implementation 'androidx.paging:paging-runtime-ktx:2.1.2'
//implementation 'com.airbnb.android:lottie:3.0.7'
implementation 'com.google.firebase:firebase-messaging:20.2.4'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.4'
implementation "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha02"
implementation 'com.google.dagger:hilt-android:2.28-alpha'
kapt 'androidx.hilt:hilt-compiler:1.0.0-alpha02'
kapt 'com.google.dagger:hilt-android-compiler:2.28-alpha'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'androidx.test:rules:1.3.0'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.3.0'
}
但是,我发现虽然它很好地删除了扩展名,但是当我转到某些文件或从中退回某些文件时,我的文件又恢复了其扩展名。当我销毁会话时,这似乎停止了。我希望这似乎不是一个琐碎或重复的问题,但是我发现有些文件隐藏了扩展名而其他文件没有隐藏扩展名是不寻常的。例如,我将看到Site / home,然后转到Site / about.php,当我回来时,我将位于Site / home.php。有什么明显的我想念的地方吗?谢谢!
解决方法
RewriteEngine开启
RewriteRule ^ index?$ index.php
,我知道了。 .htaccess文件适用于尝试执行相同操作的任何人。我的表单将转到Site / about.php,我认为它将自动更正为Site / about。我检查了代码,并从表单中删除了所有文件扩展名,href很好。这样就解决了,到目前为止没有错误!谢谢所有考虑这个问题的人。
,RewriteEngine On
RewriteRule ^about?$ Site/about.php
OR
RewriteRule ^Site/about?$ Site/about.php
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。